[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: ELIOT%cs.umass.edu@RELAY.CS.NET
- Subject: Locally
- From: "Scott E. Fahlman" <Fahlman@C.CS.CMU.EDU>
- Date: Sun, 14 Sep 1986 20:35:00 -0000
- Cc: Common-Lisp@SU-AI.ARPA
- In-reply-to: Msg of 10 Sep 1986 20:24-EDT from ELIOT%cs.umass.edu at CSNET-RELAY.ARPA
- Sender: FAHLMAN@C.CS.CMU.EDU
(locally (declare (special foo))
(let ((foo 3))
In NIL, Vaxlisp and HPCommon Lisp this form executes smoothly and
prints "3". Either all three implementations are wrong, or
the documentation is confusing (to me.)
I think that Locally (declae (special foo)) should affect
every binding and reference to foo within the body of the locally.
This would make it behave like a lexically scoped version of "proclaim".
I think that all three implementations are right, but not for the reason
you suspect. The binding of FOO within the LET is a lexical binding,
because the external special declaration has no effect on this binding.
This lexical binding is what the reference to FOO in the PRINT form
sees. This new binding shadows the SPECIAL declaration for references
lexically within the LET. See the example on page 158, which is almost
exactly the same case.
The current rules covering special declarations are strange, at best,
but I think the manual is reasonably clear, under the circumstances.
There is an example covering the case that confused you. I admit that
the example is a bit hard to follow...