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

Re: DECLARE SPECIAL Considered Confusing ?



	
    Date: Wed, 23 Jul 86 03:53:30 PDT
    From: edsel!bhopal!jonl@navajo.stanford.edu (Jon L White)
    To: navajo!NGALL%G.BBN.COM@navajo.stanford.edu
    Subject:  DECLARE SPECIAL Considered Confusing ?
    In-Reply-To: NGALL@G.BBN.COM's message of 23 Jul 1986 03:00-EDT
    Message-ID: <8607231053.AA04163@bhopal.edsel.uucp>
    
    
    Re: your question
	"How do I shadow the SPECIAL declaration if "every occurance of FOO is
	 taken to be a ... special binding"?  E.g., How can I bind X lexically
	 in the body of the following: (defun foo (x) (declare (special x))...)"
    I thought Alan's proposal didn't just simply say "every occurance ...",
    but rather "every occurance ..., unless shadowed by another declaration".
    
    Thus, assuming there is to be an UNSPECIAL, or LOCAL, declaration, which is 
    a no-op when the variable isn't declared or proclaimed special, then you can 
    insulate some small piece of context from the larger lexical context in which 
    it is embedded by just such a means.
    
I was assuming there wasn't an UNSPECIAL or LOCAL, since any
declaration proposal that requires such, is too radical a change for
my taste.

    Consider for example:
	    (defmacro square (form)
	      `(let ((temp ,form))
		 (declare (local temp) (notype temp))
		 (* temp temp)))
    Actually, many of us would probably have written "square" as:
	    (defmacro square (form)
	      (let ((temp (gensym)))	;or maybe even "(gentemp)"
		`(let ((,temp ,form))
		   (* ,temp ,temp))))
    but that is no big issue (you'll probably prefer the former if you
    are stuck with an implementation that can't GC symbols).
    
    It seems to me that Alan's proposal infuses declarations with the same 
    kind of scoping semantics that exists for variable bindings.  In the form
	(let ((a <something>))
	  . . .
	  (let ((a <something-else>))
	    . . . 
	  ))
    the meaning of this is "a is bound to something, unless it is bound
    to something else"; which is parallel to Alan's notion for declarations
    that has (unfortunately) been called "shadowing".

I think all the other proposals have this same property (but none of
them require hairy changes like a LOCAL decl-spec).
    I find the unification of these two scoping rules to be very attractive.
Me too.  That's why my proposal incorporates it.

-- Nick