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

macr --> declares



    While we're into complaining about declarations, I'd like to grouse about
    type declarations not being meaningful when not applied to a binding in
    the immediate special form or macro. The ability to say that a variable
    will always be a certain type within a small body of code is very useful
    and very common. Officially, requiring one to write a LET or the like just
    so one can write a type declaration is very annoying.

It would be even more annoying to find that you've created a nice,
local, lexical variable binding and that its type is being mysteriously
restricted by some declaration off in left field somewhere.  I think
that it is clear that we want all of the declarations relevant to a
lexical variable binding to be present right there with the binding.

Of course, a SPECIAL proclamation can have non-local effects on what
would otherwise be lexical bindings, but at least we try to minimize the
bug-creation potential of this by encouraging people to use the *foo*
convention for such globally-special variables.

What does seem to be reasonable is to allow pervasive type declarations
for global special variables.  It seems reasonable to allow something
like the following:

(proclaim (special *foo*))
(proclaim (integer *foo*))

or

(defvar *foo* 27 "Number of FOOs still to be used." 'integer)

This seems quite useful to me, and doesn't ruin the locality of lexical
bindings.

-- Scott