hi
look at these declarations:
(defun f (x)
(declare (type integer x)
(type integer y)
(special y))
(* x y))
is it possible to declare y to be both special and integer in one type
spec? i.e. (type integer (special y))
???
thanks,
dave
David Bakhash <·····@bu.edu> writes:
> is it possible to declare y to be both special and integer in one type
> spec? i.e. (type integer (special y))
no.
btw, some declarations can be ignored by the implementation.
e.g., TYPE. Others cannot be ignored. e.g., SPECIAL.
Mixing them would perhpas confuse some people.
i can understand your desire to centralize the description of a
variable, but keep in mind that though you might choose that as a
personal choice, it does not assure that all things known about that
variable are in one place. for one thing, in the case of a special,
outer TYPE declarations still apply.
for another, in the presence of macro expansiosn (macros cannot
expand into declarations, but they can expand into forms
containing decalrations by cobbling together other pieces of code),
different pieces of code might contribute different pieces of info
about your variable, and joining it textually might be hard to do.
and finally, although the compiler may not mind you having 83
different ways to put declarations together, user code probably does.
some user-code code-walks declarations and a nested syntax would make
it a lot harder to be sure you were correctly answering the question
"is this special?" or "is this of type INTEGER?"
i apologize for the tyhpos,but my net connection is wedged and i'm
typing most of this blind. the parts that i'm not typing at 110 baud,
that is and it's just too painful to go fix things.
you can, however,
(declare (type integer x y) (special y))
or just
(declare (integer x y) (special y))
it doesn't have to take up three screen lines of vertical space.