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


My gut feeling on this issue is that people would be willing to vote
it in, provided that we can guarantee that you would never have to
access the symbol's global value when there is a special binding of
the variable.  I believe this was the purpose of the amendment that
was accepted (stating that "it is an error" to specially bind a variable
that has been proclaimed lexical), but there are still some other
possible cases.

Here is what I had written on the slide I prepared at the meeting.

  Example #1:

    (let ((broken (locally (declare (lexical foo))
    		      #'(lambda () ... foo ...))))
	(let ((foo  37))
	    (declare (special foo))
	    (funcall broken)))

  Example #2:

    (defparameter bar 'global-value)

    (defun baz ()
        (locally (declare (lexical bar))

    (let ((bar  'dynamic-value))


    State that it is an error for a "free" LEXICAL declaration to
    appear in contexts where there is no lexically visible binding of
    that variable. 

The problem is that, in both examples, a closure over the global value
of the variable is being created, and you cannot prevent that function
 from being called when there are special bindings of the variable.
The rationale for the amendment is to make it impossible to create
such a closure in the first place. 

I am not entirely convinced that there aren't other "holes" remaining
that I haven't thought about, but at least this would plug one of them.