Hello,
I have discovered what looks like a bug in CLISP regarding
destructuring-bind and special variables. Consider the following:
(defvar *foo* 'bar)
(destructuring-bind (&key (*foo* *foo*)) '()
*foo*)
This returns (SYSTEM::MACRO-MISSING-VALUE).
CMUCL returns BAR as I expect. This bug(?) only appears when binding a
special variable "to itself", and only with keyword arguments. Change
&key to &optional in the above example and BAR is returned. This is also
not reproducable using defun instead of d-bind.
I don't know if the idea of binding special variables "to themselves"
(for lack of a better expression) as I do here is common or considered
reasonable, but I have found the technique quite useful in many cases.
Comments?
--
Fredrik Sandstr�m
·······@infa.abo.fi
Hello!
Fredrik Sandstrom <·······@infa.abo.fi> wrote:
>[...]
>(defvar *foo* 'bar)
>(destructuring-bind (&key (*foo* *foo*)) '()
> *foo*)
>[...]
clisp 2.27 on OpenBSD/x86 returns bar from the second form, as you
expect.
Kind regards,
Hannah.
······@schlund.de (Hannah Schroeter) writes:
> clisp 2.27 on OpenBSD/x86 returns bar from the second form, as you
> expect.
Strange, on my clisp 2.27 on FreeBSD/x86 the bug is there, and is
evident from the macro-expansion of destructuring-bind:
(macroexpand-1 '(destructuring-bind (&key (*foo* *foo*)) nil *foo*))
=> (LET ((SYSTEM::<DESTRUCTURING-FORM> NIL))
(LET* ((#:G1199 SYSTEM::<DESTRUCTURING-FORM>)
(*FOO* (GETF #:G1199 :*FOO* SYSTEM::MACRO-MISSING-VALUE))
(*FOO* (IF (EQ *FOO* SYSTEM::MACRO-MISSING-VALUE) *FOO* *FOO*)))
(SYSTEM::KEYWORD-TEST #:G1199 '(:*FOO*))
*FOO*)) ;
This suggests that the bug doesn't relate to the symbol being special,
and indeed it isn't:
(destructuring-bind (&key (x x)) nil x)
=> (SYSTEM::MACRO-MISSING-VALUE)
% clisp --version
GNU CLISP 2.27 (released 2001-07-17) [..]
I'd say this should be reported to the maintainers of clisp.
--
Frode Vatvedt Fjeld
> * In message <······················@deepthought.coax>
> * On the subject of "destructuring-bind CLISP bug?"
> * Sent on Thu, 29 Aug 2002 16:19:40 +0300
> * Honorable Fredrik Sandstrom <·······@hal.sby.abo.fi> writes:
>
> I have discovered what looks like a bug in CLISP regarding
> destructuring-bind and special variables. Consider the following:
>
> (defvar *foo* 'bar)
> (destructuring-bind (&key (*foo* *foo*)) '()
> *foo*)
>
> This returns (SYSTEM::MACRO-MISSING-VALUE).
I just fixed this bug in the CLISP CVS.
I cannot read USENET on weekdays, and not always even on weekends, so if
you want your CLISP bugs fixed, please report them to <clisp-list>.
Thanks.
--
Sam Steingold (http://www.podval.org/~sds) running RedHat7.3 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Press any key to continue or any other key to quit.