[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Type specifiers in THE constructs
Does the type-specifier in (THE <type-spec> (MUMBLE)) refer to the type
of the first value (of zero or more values) returned by (MUMBLE), or does
it refer to the multiple-value spectrum? In short, is is a shorthand for
1. (THE (VALUES <type-spec> &REST T) (MUMBLE))
2. (THE (VALUES <type-spec>) (MUMBLE))
Of the five implementations I've looked at, three do it like the former and
two do it like the latter.
Wording on CLtL p161 seems to suggest a meaning like the former:
"For this purpose the THE special form is defined; (THE TYPE FORM)
means that the value of FORM is declared to be of type TYPE."
Note that it says "the value of FORM", not "the values of FORM". Also
supporting the latter is the documentation of (VALUES ...) as a type
specifier, on CLtL p48: "It is used to specify individual types when
multiple values are involved"; i.e., an exception to the "normal" case
of specifying "the value" is made when you want to talk about the other
Wording on CLtL p138 seems to suggest the latter; namely THE "passes
back" multiple values, so the <type-spec> might want to refer to the
spectrum being "passed back". Note that this interpretation makes
(THE NUMBER (TRUNCATE 10 3)) an illegal form.
-- JonL --