[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> wrote:
Emmanuel Medernach scripsit:

> Why not specifying that arguments in procedure calls should each
> evaluate to exactly one value ?

Everyone agrees that (+ (values 1 2) (values 10 20)) is meaningless,
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
value, CL-style.


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
R5RS/R6RS divide.

As you say, some implementation reifies 'values'.  However the R[567]RS 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 ?

Best regards,
--
Emmanuel Medernach
_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports