[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issue: DECLARATION-SCOPE
Scott asks, ``Is there any effective difference between saying that "free"
declarations surround the whole form and saying that they surround only the
body, but that the init forms are part of the body? If not, the former way of
stating it seems clearer.''
I assume that this is addressed to my suggestion that free declarations in
LAMBDA-forms cover the default-value expressions in &optional, &aux, and &key
parameters. The point is that I would rather that such declarations didn't
cover the init-expressions in LET and the bodies of the lexical functions in
FLET and LABELS. If you macroexpand LET in the obvious way, with the
declarations inside the LAMBDA form, then the init forms are outside of the
scope of the free declarations, as I would desire.
I think that the reason that I want this is that in the following:
(let ((foo init-expression))
(declare ((bound-declaration foo)
(free-declaration)))
body)
the free declaration covers the init expression while the bound one does not. I
think of declarations as appearing at the head of the code that they cover and
so I'd want both of these declarations to cover only the body. In fact, I think
that I would rather that the free declarations in a LAMBDA form only cover the
real body, and not the default-value expressions, for just this reason. I guess
that I'm not impressed by Kent's example since I don't see very much use for
local declarations around default-value expressions. Perhaps he'll show me some
startlingly clear-cut example of this being useful.
Bound declarations, on the other hand, should have identical scope with the
variable to which they refer. This seems intuitive since they are, in effect,
changing the overal meaning of that variable.
Pavel