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

Re: multiple values



I'd like to bring up another multiple-value proposal but first I
have a question.  Why is the scheme community attempting to
standardize this now?  Is it really that well understood?

This proposal is a variant on the technique Carolyn Talcott used
in her thesis; Richard Weyrauch was also involved in that work.

Their idea requires one procedure; I'll call it values.  Procedure
invocation spreads multiple values; (cons (values 1 2)) is completely
equivalent to (cons 1 2) and (list (values) 4 (values 1 2) 3) is
equivalent to (list 4 1 2 3).  (It should be obvious that (values 1)
is completely equivalent to (values (values 1)).)  In Talcott's
system, the last variable in a lambda expression's formal argument
list is preceded by an implicit period; I feel that the optional
explicit period of r^3rs' syntax is superior.

Call/cc is generalized appropriately as well.  If I understand
receive-values correctly, it is the same as apply.

Most of the other proposals strike me an attempt to add yet another
aggregate data type (in addition to lists and vectors) that predefined
procedures will use to return a number of values.  This is not a bad
idea, different implementations can use different representations, yet
the coercion rules and additional procedures (if a form returns
multiple values, all but the first are discarded unless the programmer
has mastered subtle rules involving tokens not unlike funcall and #')
bother me.

Talcott's scheme is succinct and builds on the rest of the language.
(Look how much of this message was used to explain the idea.)  Its
only disadvantage is that you can't tell how many arguments are being
passed by counting s-expressions.

-andy
-------