[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Proposal #14: THE and VALUES
Date: Mon, 21 Jul 1986 21:46 EDT
From: "Scott E. Fahlman" <Fahlman@C.CS.CMU.EDU>
Specify that in (THE (VALUES ...) form), the form may return more
values, but not fewer, than the number of types specified in the (VALUES
...) form, and that any extra values are of unrestricted type.
Also specify that (THE type form) where type is not (VALUES ...) is
equivalent to (THE (VALUES type) form).
I agree completely with MacLachlan's comments, enclosed. Both parts of
the proposal should be rejected. I do have one query; see below.
Plummer's suggestion of a standardized way to coerce a result to a
particular number of values sounds useful but should be raised as a
separate issue.
Date: Wed, 23 Jul 1986 09:50 EDT
From: Rob MacLachlan <RAM@C.CS.CMU.EDU>
Well, I think everyone is wrong about this one. (THE (VALUES ...) ...)
specifies the functional type of the continuation. This is in effect
what CLTL already says: "...indicates the parameter list of a function
that, when given to multiple-value-call along with the values, would
be suitable for receiving those values."
My question is whether the quoted text (CLtL p.48) is a mistake. It could
have been accidentally retained from the days when multiple-value-bind
allowed & keywords, or it could be intentional.
I strongly disagree with any proposal which gives THE mandatory
run-time semantics. THE is a declaration --- its presence should not
change the meaning of a correct program. If the form returns too many
values, then the program is in error and the result is undefined.
I agree that it is highly desirable to be able to specify the
type of the first value without worrying about the actual number of
values. To this end, I propose that (THE FOO ...) should be
synonomous with the (THE (VALUES FOO &REST T) ...). This allows one
to say things like (THE FIXNUM (TRUNCATE ...)).
It should also be clarified that the VALUES type specifier may
have &ALLOW-OTHER-KEYS.