emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bogus change(s) in cl-macs.el


From: Stefan Monnier
Subject: Re: bogus change(s) in cl-macs.el
Date: Fri, 19 Nov 2004 02:10:55 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

> I found the simplest way to explain the bug:

> (macroexpand
>  '(labels ((FOO nil FOO-BODY)
>          (BAR nil BAR-BODY))
>     (FOO)
>     (BAR)))

> (let ((--cl---cl-var---- nil)
>       (--cl---cl-var---- nil))
>   (progn
>     (progn
>       (set '--cl---cl-var---- #'(lambda nil BAR-BODY))
>       (set '--cl---cl-var---- #'(lambda nil FOO-BODY)))
>     (funcall (symbol-value '--cl---cl-var----))
>     (funcall (symbol-value '--cl---cl-var----))))

> One of two functions FOO and BAR is disregarded as you see.

Well, actually we can't see it here because you haven't used print-gensym
to distinguish symbols with the same name.  But indeed:

  (labels ((foo nil 1) (bar nil 2)) (cons (foo) (bar)))

returns (1 . 1).  This is because cl's macro environment uses symbol names
rather than symbols for symbol-macros, so if two symbols have the same name
(i.e. `eq', not just `equal') and they both are symbol-macros, then
CL screws up.  I'm working on a patch for that.


        Stefan


PS: A symbol-macro is a macro `foo' that is not triggered by (foo bla bla)
but by a mere `foo'.
E.g. (symbol-macrolet ((x (hello))) (+ x 1)) => (+ (hello 1))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]