[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bawden's Alternate Proposal



Before we get carried away, there are a few advantages to lexical
scoping....

[A simple example:

(defmacro call-double (fn value) `(let((a ,value)) (,fn a a)))

You don't want pervasive declarations in the  context of the macro
invocation to muck with what "a" means.

]

One source of problems with "special" declarations is that they talk
about two different things: references & bindings. Since we're
considering radical changes, lets consider separating out the two uses:

Masinter's alternative:

(DECLARE (SPECIAL var1 var2 ...))

only affect the *binding* of var1 and var2. Which binding? Only the one
that they are lexically apparent in. SPECIAL declarations can only occur
in declarations in LAMBDA and LET and are only meaningful for the
variables that are actually bound there. 

How do you tell if a *reference* is special or lexical? A reference is
lexical if the variable is lexically apparent, and special if it isn't.

If you want, we can add another declaration (SPECIAL-REFERENCE var1 var2
...) which is like (IGNORE var1 ...) in that its only use is to turn off
compiler warnings. In this case, if you declare something as
USED-FREELY, the compiler won't warn about special references to
variables that aren't PROCLAIMed special.

(Interlisp has this separation: special declarations are done with
SPECVARS, while reference declarations, just there to turn off warnings,
are done with USEDFREE.)