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

(THE (VALUES ...) ...) with &KEY

CLtL, on page 48, says, in reference to the VALUES type specifier,

``The &OPTIONAL, &REST, and &KEY markers may appear in the value-type
list; they thereby indicate the parameter list of a function that, when
given to MULTIPLE-VALUE-CALL along with the values, would be suitable to
receiving those values.''

I assume from this that the following form is legal and specifies that
it is an error for FOO to return less than 3 values, the first of which
should be an integer and the second of which should be a float:

	(the (values integer &optional float &rest cons) (foo))

The insistence on three or more values comes from the requirement that
the &REST list be of type CONS; if fewer values were returned, it would
be NIL, not a cons-cell.  Thus, the &optional in this case is

I would also guess that this next form requires BAR to return either one
or two values, the first of which must be a string and the second of
which, if provided, must be an array:

	(the (values string &optional array) (bar))

I am at a loss, however, to figure out how to use the &KEY keyword.
What is the right syntax for invoking this arcane feature?  Perhaps each
keyword ``parameter'' should be a list of two elements, a symbol naming
the appropriate keyword and the type the corresponding value should
have?  This seems reasonable (at least relative to the whole notion
being reasonable), but none of the implementations I've tried understand
any of the lambda-list keywords, let alone &KEY...

Does anyone implement this?  Does anyone (shudder) use it?  Could we
just eliminate it from the language?  Cleanup committee, are you