[Larceny-users] writing values writes the first value only

will at ccs.neu.edu will at ccs.neu.edu
Wed Jun 3 23:06:28 EDT 2009


Marco Maggi wrote:
>   using Larceny checkout 6282 on i686-pc-linux-gnu I see:
> 
> (write (values 123 456))
> => 123

That is correct behavior for Larceny, whose semantics for
multiple values is mostly compatible with Common Lisp, which
provided the original model for Scheme's multiple values.

> while Ikarus raises an  "incorrect number of values returned
> to single value context" error, and Ypsilon prints "#<values
> 123 456>".   Larceny's behaviour is confusing  when WRITE is
> used for debugging purposes.  Can something be done?

Ikarus and some other systems are incompatible with both
Ypsilon and Larceny in this respect.  Similarly, Ypsilon's
behavior is incompatible with both Ikarus and with Larceny.
All of those behaviors are permitted by both the R5RS and by
the R6RS.  The bottom line is that passing zero values or more
than one value to an ordinary continuation (which expects one
value) has undefined semantics.  (As of the R6RS, command
continuations are no longer ordinary continuations, but R5RS
command continuations are ordinary, so there is a definite
incompatibility between the R5RS and R6RS here also.)

>   I do not want to enter a debate over the True Semantic
> Meaning of things, I just want some help when debugging.

This has long been a source of contention within the Scheme
community, and it is unlikely that consensus will be achieved
within the forseeable future.  To detect non-portable code,
your best bet is to define your own abstractions for multiple
values and to give them your own favored semantics.  In short,
you may want to deprecate multiple values within your own code.

The R6RS library system gives you the power to define your own
base library absent multiple values, and you can wrap your own
abstractions around all inter-library calls to perform whatever
run-time checking you consider appropriate (if you distrust
libraries that may use multiple values internally).

> P.S.  Sorry if this has been discussed before.  Is there a
> way to search the  mailing list archive  better than a row
> google search on "larceny-users write values"?

Not that I know.

Will



More information about the Larceny-users mailing list