[Openmcl-devel] Where is the source of LET* macro
Ron Garret
ron at flownet.com
Fri Apr 14 15:15:10 PDT 2023
> On Apr 14, 2023, at 2:50 PM, Tim Bradshaw <tfb at tfeb.org> wrote:
>
> My form was meant to tease these cases apart: I believe that CCL & LW exhibit correct behaviour here. However my belief in that is only because (unless I have missed it in the standard) anything else requires quite significant repairs to the standard: it can't just fail to say which bindings are affected if the answer is not 'all of them'.
I dunno, I think a perfectly reasonable interpretation is "all the bindings that are VISIBLE at the point where the declaration appears."
I think this point of view is particularly defensible in light of the fact that the spec says that declarations appear at the *beginnings* of the *bodies* of certain forms. Why would a declaration affect a binding not visible in that referenced body? In other words, declarations don't look "backwards" to "find" bindings, they look *forward* to affect *references* to bindings. This is the reason that:
(let (x) (declare (special foo)) x)
is not an error despite the non-existence of a binding for FOO for the declaration to affect.
This also resonates with the LOCALLY form, where the whole point is to stop declarations from reaching backwards into the code to affect bindings, e.g.:
? (setf x 1)
1
? (let ((x 2)) (list x (locally (declare (special x)) x)))
(2 1)
More information about the Openmcl-devel
mailing list