[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] multiple values module
On Sat, May 21, 2011 at 7:45 PM, John Cowan <cowan@x>
Emmanuel Medernach scripsit:
Everyone agrees that (+ (values 1 2) (values 10 20)) is meaningless,
> Why not specifying that arguments in procedure calls should each
> evaluate to exactly one value ?
but that does not mean that every implementation must be required to
treat it in exactly the same way. As things stand, some implementations
report errors, others silently truncate multiple values to a single
Well, of course. It depends if the implementation decided that 'values' is a reifed object or not : if it is then there is no problem being in argument position, if it is not then door is open about how interpreting it as a single value (as Chicken does by discarding other values) or to raise an error.
Except for continuations created by the call-with-values procedure,
all continuations take exactly one value. The effect of passing no
value or more than one value to continuations that were not created
by call-with-values is unspecified.
Therefore code relying on this cannot be portable, isn't it ?
I tested my usual suite of Schemes with (+ (values 1 2) (values 10
20)). MIT, Gambit, Kawa, Chibi, Ypsilon, IronScheme, STklos complain
in a way that make it clear they are reifying multiple values; Racket,
Scheme48/scsh, SISC, Chez, Ikarus complain in a way that makes it
impossible to tell; Gauche, Chicken, Bigloo, Guile, Larceny, Mosh,
STklos return 11, showing that they silently truncate. (Scheme 9
does not provide multiple values.) So this distinction cuts across the
As you say, some implementation reifies 'values'. However the RRS definition of values currently forbids to reify it as I understand it :
(values obj ...) procedure
Delivers all of its arguments to its continuation.
As report has to reflect on current practices, should we do something about it ?
Scheme-reports mailing list