Hi Ludovic,

On Mon 16 Mar 2009 23:16, l...@gnu.org (Ludovic Courtès) writes:

>   scheme@(guile-user)> ,o interp #t
>   scheme@(guile-user)> (define v (values 0 1 2 3))

Here you enter territory that is explicitly undefined by the Scheme
spec (R5 and R6, I think).

>   scheme@(guile-user)> ,o interp #f
>   scheme@(guile-user)> (define v (values 0 1 2 3))

Here as well. What the VM does was a conscious decision, to discard
extra values. So `v' is now 0.

>   scheme@(guile-user)> (let-values (((a b c d) v)) (list a b c d))

And obviously v is not a MV-producing expression.

> OTOH, I suspect that the effect of storing multiple values in a single
> variable is not specified anyway. (FWIW, Bigloo discards all values but
> the first and Ikarus throws an error.)

There are two things that an implementation might sensibly choose to do
when more values than expected are returned to a continuation:

  - Error.

  - Truncate the values to the number that was expected.

Guile does neither :) Which has its uses, I guess, but it prevents
efficient implementation. On the VM, returning multiple values is really
cheap. There's no consing involved.

So I would say about this: we can probably deal with it. It's
unspecified anyway, and is really an edge case.

Happy hacking,

Andy
-- 
http://wingolog.org/


Reply via email to