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

THE VALUES



    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."

	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 ...)).

OK, I can buy that.  I still want a form for run-time semantics for the
purposes of multiple-value-call and multiple-value-list.  Something like
	(take-values <something>
		     <form>)
where <something> is not evaluated and can be either a non-negative integer
which is the number of values, or a list of type specifiers.  (An
integer is shorthand for (t t ...).)  The take-values form returns
exactly the number of specified values, by truncating or padding the
values returned by <form> as necessary.  This can be naively implemented
as a macro given what is currently in CLtL, but I think it is useful
enough for some compilers to take advantage of it that it should be
considered part of the language.

	It should also be clarified that the VALUES type specifier may
    have &ALLOW-OTHER-KEYS.