[Ecls-list] ContextL functions with &key args don't work properly in ECL.

Stelian Ionescu sionescu at cddr.org
Thu Feb 25 16:06:18 UTC 2010


On Thu, 2010-02-25 at 15:42 +0100, Pascal Costanza wrote:
> 
> On 25 Feb 2010, at 15:32, Juan Jose Garcia-Ripoll wrote:
> 
> > On Thu, Feb 25, 2010 at 3:20 PM, Pascal Costanza <pc at p-cos.net>
> > wrote:
> >         Hi,
> >         
> >         I have changed Closer to MOP for ECL in such a way that
> >         &allow-other-keys is added when &key is present in a method
> >         lambda list, so it now does the same ECL does. The change is
> >         in the Closer to MOP repository. Could you check whether
> >         that solves your problem? (As far as I can tell, it should.)
> >         
> >         I don't think the issue with (debug 3) concerns me as the
> >         ContextL maintainer, but I'm not user? Do you think that's a
> >         ContextL issue, or rather an ECL issue?
> > 
> > 
> > I do not know how ContextL expands its method expressions. If they
> > are unnamed lambda lists, then they will not show with names in the
> > debugger stack trace, while if they are named lambda lists they show
> > with proper names. See for instance
> > 
> > 
> > (defvar *b*)
> > 
> > 
> > (defvar *a* #'(lambda (x) (declare (optimize (debug 3))) (cos x)))
> > 
> > 
> > (defvar *b* #'(ext:lambda-block foo (x) (declare (optimize (debug
> > 3))) (cos x)))
> > 
> > 
> > When compiled and loaded, the following session takes place. Only in
> > the second case there is a meaningful name in the backtrace
> > 
> > 
> > (declaim (optimize (debug 3)))
> > 
> > 
> > (defvar *b*)
> > 
> > 
> > (defvar *a* #'(lambda (x) (declare (optimize (debug 3))) (cos x)))
> > 
> > 
> > (defvar *b* #'(ext:lambda-block foo (x) (declare (optimize (debug
> > 3))) (cos x)))
> 
> 
> So in other words I should prefer ext:lambda-block over just lambda?
> 
> 
> Does lambda-block have any other semantics, other than giving a lambda
> a name?

A portable implementation of this comes from Alexandria:

(defmacro named-lambda (name lambda-list &body body)
  "Expands into a lambda-expression within whose BODY NAME denotes the
corresponding function."
  `(labels ((,name ,lambda-list , at body))
     #',name))

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.
http://common-lisp.net/project/iolib
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20100225/d48fa241/attachment.sig>


More information about the ecl-devel mailing list