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

Re: Making multiple values more consistent



I would like to promote the following rule.  If the result of a function
is used as an argument to a function, bound to a variable, or setq'ed
to a variable, only the first value of that function is used.  If the result
of a function appears last in an explicit or implicit progn, and will
be the result of the containing form, then all values are propagated upward
to that containing (special) form.  I think this will produce much more
consistent results.

Currently the interpreter does this for lambda-combinations and function
bodies, but I don't think it does it for other implicit progn's such as
cond clauses and exitvalues in new-style DO's.

The compiler does not currently do this.  There are two cases: (1) the
result of the function will propagate up to be the result of the calling
function.  The microcode can easily be changed to make this work by checking
for D-RETURN on the call, when an attempt is made to return multiple values.
This may take the place of indirect-ADI.  (2) the result of the function
will be used by an internal multiple-value, multiple-value-list,
multiple-value-bind, etc.  This probably requires some extension to the
compiler's destination mechanism to make work in all cases.

I don't think any of these changes will be hard to do.

Opinions?