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

issue PROCLAIM-LEXICAL



There seem to be three somewhat separate extensions being considered in
this proposal.

First is a declaration for variable bindings which allows you to request
a lexical binding, shadowing SPECIAL proclaimations for bindings, e.g.
	(proclaim '(special *x*))
	(let ((*x* nil)) (declare (lexical *x*)) .. *x* ..)
This introduces no new lookup mechanisms or binding environments, and
a lot of users are asking for it, so it seems pretty uncontroversial.

Second is a declaration for variable references which allows you to request
a reference to the lexical binding of a variable, shadowing SPECIAL
declarations for references, e.g.
        (let ((x 'lexical))
	  (locally (declare (special x))
	  ... (locally (declare (lexical x)) x) ...))
This introduces no new concepts whatsoever, being equivalent to:
	(let ((x 'lexical))
	  (flet ((lexical-x () x))
	    (locally (declare (special x))
	      ... (lexical-x) ...)))
so I would think it would be uncontroversial as well.

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.

I think it would be a good idea to put the first two extensions in a separate
proposal so they don't get lost or mangled in the controversy over LG lookup.
LG lookup can then be considered as an additional extension. This seems better
than putting it all in one proposal and then waging the battle over the LG
aspect in an endless stream of possibly incompatible amendments.