[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DEFUN inside LET
- To: DCP@SCRC-STONY-BROOK.ARPA, JAR%MC.LCS.MIT.EDU@mit-ems.ARPA, NGALL%G.BBN.COM@mit-ems.ARPA
- Subject: Re: DEFUN inside LET
- From: Steven Haflich <smh@mit-ems.ARPA>
- Date: Thu, 30 Jan 86 17:18:25 est
- Cc: common-lisp@SU-AI.ARPA
> From @SU-AI.ARPA:NGALL@G.BBN.COM Thu Jan 30 11:27:51 1986
> > Also, since DEFUN is a macro, it's hard to imagine what it could expand
> > into in order to behave much differently from this.
> Imagine this:
> (defmacro simple-defun (name lambda-list &body body)
> `(setf (symbol-function ',name)
> '(lambda ,lambda-list ,@body)))
> The quote in front of the lambda ensures that the lambda expression is
> defined in the null lexical environment.
Wouldn't one instead use:
(defmacro simple-defun (name lambda-list &body body)
`(setf (symbol-function ',name)
(function (lambda ,lambda-list ,@body))))
This would seem to capture the lexical environment quite unambiguously.
If, as DCP suggests, a defun that captures its lexical environment is
really a "time bomb", defun could be "fixed". But how could it be
possible to prohibit constructions like the above?