[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: issue PROCLAIM-LEXICAL
- To: Gail Zacharias <gz%spt.entity.com@NSS.Cs.Ucl.AC.UK>, cl-cleanup@sail.stanford.edu
- Subject: Re: issue PROCLAIM-LEXICAL
- From: Jeff Dalton <jeff%aiai.edinburgh.ac.uk@NSS.Cs.Ucl.AC.UK>
- Date: Mon, 6 Feb 89 18:25:20 GMT
- In-reply-to: Gail Zacharias's message of 5 Feb 89 18:09:14 EST (Sun)
> There seem to be three somewhat separate extensions being considered in
> this proposal.
I agree that the first two issues you identify should not be
particularly controversial. However, the existence of a lexical
declaration more or less implies that there is a corresponding
proclamation, so I think we should try to give that proclamation a
reasonable meaning and separate the proposals only if that proves too
difficult.
> Finally there is the question of a declaration/proclamation which
> applies to free variable references (i.e. not referring to a lexical
> binding), which in the current proposal introduces LG lookup allowing
> you to "close over" global values of variables. This is a new a new
> concept to Common Lisp, and is clearly controversial.
It may be misleading to think of it as "closing over". The LG
proposal has only one global environment, and closures would not
need to contain any new information.
One of the problems this proposal tries to address is that in
Common Lisp it's difficult to have a global variable whose name
can also be used as a normal (lexical) variable. Since SPECIAL
proclamations affect all bindings involving the name so proclaimed
(and not just free references), a SPECIAL proclamation, or a DEFVAR,
prevents the name from being used as a non-special variable.
So how do I get a global variable of the sort that almost all
programming languages have? I could try just setting its value,
avoiding DEFVAR and the like. But then many compilers complain
about free references. I don't suppose any of them actually go
so far as to proclaim the name special, but some Lisps certainly
did do that in the past.
The LG proposal attempts to solve this problem, plus the two
other cases you mentioned, in a consistent way. I think the
explanation in terms of L, G, and D environments is fairly
clear and easy to understand, although I'm not entirely
happy with the emphasis on "searching" the environments.
I'd prefer a more static description, if possible.
So far, the alternative proposals handle fewer cases (the GLOBAL
proclamation) or are less consistent (e.g., you can override a SPECIAL
proclamation by using a LEXICAL declarations on a binding but can't
override a LEXICAL proclamation by using a SPECIAL declaration).
I would be wary of adopting a less consistent proposal, because it
would be harder to explain, understand, and use. GLOBAL seems to me
too much of a special case and seems more appropriate to a Lisp that
emphasises dynamic binding (such as InterLisp) than to one that
encourages the use of static scoping. A third possibility, changing
SPECIAL proclamations so that they do not affect bindings, is likely
to die on the grounds of incompatibility.
So that leaves LG, which is still the alternative I favor.