[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] "unspecified values"



Andy Wingo scripsit:

> On Sat 21 May 2011 15:57, Jim Rees <jimreesma@x> writes:
>
> > apparently every major implementation wraps up multiple values
> > into a single first-class object which can be passed around until
> > a call-with-values detects it and de-composes it again  (please
> > correct me if I'm wrong).
>
> Guile does not do this.  Chez does not either FWIW.  Dunno about
> ikarus; I think that it also follows the approach I linked to
> previously:
>
>   http://www.cs.indiana.edu/~dyb/pubs/mrvs.pdf

Chicken doesn't either: it CPS-converts everything, so that procedures
and continuations are the same thing, and returning multiple values to
a continuation is just calling a procedure with multiple arguments,
IMO a very elegant approach.  The only drawback is that the compiler
can usually tell how many arguments a procedure expects, whereas a
continuation has to check at run time how many values it got, and take
corrective action if the number is wrong.

As I posted earlier, Chicken uses the "truncate two or more values
to the first value" strategy.  If no values are received but one is
expected, Chicken continuations get the #<undefined> object.  This is
the same one returned by standard procedures returning "an undefined
value", and is also returned by the Chicken core procedure `void`.

-- 
Deshil Holles eamus.  Deshil Holles eamus.  Deshil Holles eamus.
Send us, bright one, light one, Horhorn, quickening, and wombfruit. (3x)
Hoopsa, boyaboy, hoopsa!  Hoopsa, boyaboy, hoopsa!  Hoopsa, boyaboy, hoopsa!
  --Joyce, Ulysses, "Oxen of the Sun"       cowan@x

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports