Discussion:
values in a non-values context
Matt Wette
2018-06-15 00:56:12 UTC
Permalink
I've looked in some RnRS documents and can't find answer to the following:
Is the value of a `values' expression in a non-values context defined?
In Guile, `(write (values 1 2 3))' generates `1'. Does the language standard
specify this or is this determined by implementation? In other words, is it
OK to count on this behavior?

Matt
John Cowan
2018-06-15 01:16:57 UTC
Permalink
It's determined by the implementation. <
https://bitbucket.org/cowan/r7rs-wg1-infra/src/default/MultipleValues.md>
lists what several implementations actually do. Many similar pages are
accessible from <
https://bitbucket.org/cowan/r7rs-wg1-infra/src/default/ImplementationContrasts.md
Post by Matt Wette
.
Is the value of a `values' expression in a non-values context defined?
In Guile, `(write (values 1 2 3))' generates `1'. Does the language standard
specify this or is this determined by implementation? In other words, is it
OK to count on this behavior?
Matt
Ludovic Courtès
2018-06-16 15:48:55 UTC
Permalink
Hi,
Post by John Cowan
It's determined by the implementation. <
https://bitbucket.org/cowan/r7rs-wg1-infra/src/default/MultipleValues.md>
lists what several implementations actually do. Many similar pages are
accessible from <
https://bitbucket.org/cowan/r7rs-wg1-infra/src/default/ImplementationContrasts.md
.
Indeed. The choice starting with Guile 2.0 was to automatically
truncate multiple value returns in accordance with the number of values
expected by the continuation.

You can rely on multiple-value truncation in Guile, but be aware that
other Schemes may behave differently.

Ludo’.

Loading...