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

Syntax for uninitialized-let



  I used for some time (let (x) ..) to introduce uninitialized binding
rather than (let ((x)) ..) which visually seems to me rather to
introduce a binding with an unspecified value. Besides that the latter
uses two extra parentheses, the behavior is different in the two cases
since:
        (let (x) x) is erroneous and should raise an "uninitialized variable"
                    error whereas
        (let ((x)) x) just returns an unspecified value.

   The (let (x) ..) syntax is used in CommonLisp to be equivalent to
(let ((x nil)) ..) but can be used by Scheme to introduce a new local
uninitialized binding. This turns let into a new special form, the
alternative is to introduce uninitialized-let for this purpose and to
extend the syntax of let to use it.

  With respect to eval, uninitialized bindings introduce a distinction
between what is traditionally called "unbound variable" and
"uninitialized variable". Consider:

(eval '(let (x) x 1)) raises "uninitialized variable" (and do not yield 1). 

(eval 'y) raises "unbound variable" or "uninitialized
variable" depending on the exact nature of the global bindings of the
toplevel (whether created (by define) or pre-existant (and uninitialized)).


		Christian.