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

Issue: PROCLAIM-LEXICAL (Version 7)



    Date: Mon, 26 Sep 88 12:02:11 pdt
    From: Eric Benson <eb@lucid.com>

       Date: Sat, 24 Sep 88 19:32 EDT
       From: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>

       Test Case:

	 #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 4))
					   #'(lambda () (list x y))))))))
	     (tst) => (1 4 (5 4))

    Maybe I'm confused, but I thought this should be (1 2 (5 4)) ...

You're not confused -- you're just polite. I was probably too burnt out
after putting this whole thing together to check the example as
thoroughly as I should have. It was merged and edited from one of the
numerous other drafts, and... Also, Jonathan's feedback to me said
explicitly that he didn't bother to check the example. I should have
known that meant trouble...

There's also the other `error' about the second y binding, which should
have been to 6, not to 4.

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))

By the way, completely as an aside:

 If LEXICAL were defined to mean LDG search rather than LG search,
 then the result would have been (1 4 (5 4)). That was what Moon's
 proposal had suggested.

 However, there's something very asymmetric and unsettling about
 having DYNAMIC mean DG and LEXICAL mean LDG. One way to reach
 harmony is LEXICAL=LG as we've proposed, but it occurs to me
 as a curiosity that you could define DYNAMIC=DLG. I can't imagine
 what the practical value of that would be, and it might be kinda
 odd compiled, but it would keep from upsetting my sense of 
 symmetry and it would lead to the interesting result of (3 4 (5 4)),
 which is marginally more intuitive than (1 4 (5 4)).