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

I Like a Single Namespace



    Date: Mon, 22 Jun 87 13:53:15 GMT
    From: Christopher Dollin <kers%hplb.csnet@relay.cs.net>

    Issues in Function and Value Cells
    ------ -- -------- --- ----- -----

    [...]
    Without this one has to restore to
    unwind-protects or double declarations as in

	(let ((old-special-variable special-variable))
	    (let ((special-variable expression-involving-old-special-variable))
		bit-that-does-the-work
	    )
	)

    where the unholy conspiracy between the structure of let-bindings and the
    behaviour of dynamic binding leaves a lot to be desired, especially if more
    than one special variable is being so modified.

The above is not necessary in any Maclisp-descended Lisp I'm familiar
with.

	(let ((*special-var* *special-var*))
	  bit-that-does-the-work)

works fine (and is used quite often) in Maclisp, Zetalisp, and Common
Lisp.  The expressions in a LET value form are evaluated in the dynamic
environment OUTSIDE the LET.  You may be confusing this with the fact
that declarations at the beginning of a LET body refer to variables in
the value forms; this means that you can't do

	(let ((*special-var* *special-var*))
	  (declare (unspecial *special-var*))
	  bit-that-does-the-work)

and have the lexical *SPECIAL-VAR* get initialized from the dynamic
*SPECIAL-VAR*.

						barmar