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

Issue: PROCLAIM-LEXICAL (Version 7)



   Date: Mon, 26 Sep 88 17:35 EDT
   From: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>

       Date: Mon, 26 Sep 88 14:07:48 pdt
       From: Eric Benson <eb@lucid.com>

	  Date: Mon, 26 Sep 88 15:44 EDT
	  From: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>

	  Does the following look ok to you?

	    #1: (proclaim '(lexical x))
		(proclaim '(special y))
		(setq x 1 y 2)
		(defun tst ()
		  (let ((x 3) (y 4))
		    (locally (declare (special x) (lexical y))
			     (list x y
				   (funcall (let ((x 5) (y 6))
					      #'(lambda () (list x y))))))))
		(tst) => (1 2 (5 4))

       I think that's (1 2 (5 6)).

   No, I'm not as tired this time, and I think I'm right ...

    X gets bound lexically to 3 because X is [pervasively] proclaimed LEXICAL.
    Y gets bound specially to 4 because Y is [pervasively] proclaimed SPECIAL.
    Reference style for name X is changed to SPECIAL, making lexical X=3 invisible.
    Reference style for name Y is changed to LEXICAL, making dynamic Y=4 invisible.
    Global X=1 and global Y=2 are first two elements of list.
    X gets bound lexically to 5 because X is [pervasively] proclaimed LEXICAL.
    Y gets bound specially to 6 because Y is [pervasively] proclaimed SPECIAL.
    Closure is returned, capturing [lexical] X=5 but not [special] Y=6.
    Dynamic binding of Y to 6 disappears, dynamic binding of Y to 4 reverts.
    Closure is funcalled, returning captured X=5 and dynamically active Y=4
     in a list which becomes third list element.

   Make sense?

Clear as mud!  The point I was forgetting is that proclamations affect
references *and* bindings, while declarations only affect the bindings
to which they are attached (if any), and references *for which are
there are no intervening bindings*.  There's still no such thing as a
pervasive declaration, either for SPECIAL or LEXICAL.

Do you want to make LEXICAL the default for otherwise unspecified
references?  It still might be a good idea to warn about the absence
of any declaration.