[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: what was that LET () for?
- To: firstname.lastname@example.org
- Subject: Re: what was that LET () for?
- From: haible (Bruno Haible)
- Date: Wed, 21 Dec 94 21:21:01 +0100
Don Cohen <donc@ISI.EDU> found the following piece of code in CLISP
(defmacro with-keyboard (&body body)
`(LET () (PROGN ,@body))
and asked: BTW, what was that LET () for?
This matters only if a (WITH-KEYBOARD ...) form occurs as a top-level form
in a file (which, I admit, is not likely for this particular macro).
If it expanded to PROGN only, the body forms would be compiled separately
by COMPILE-FILE. Since CLISP's compiler doesn't preserve EQ-ness of
objects across top-level forms, this would be noticeable:
(WITH-KEYBOARD (setq x #1="foo") (setq y #1#) (print (eq x y)))
would print T when loaded from a .lsp file and NIL when loaded from a .fas
file. The LET () inhibits splitting the body forms and thereby avoids this
difference between interpreted and compiled code.