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

Issue: PROCLAIM-LEXICAL (Version 7)



    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?