[Prev][Next][Index][Thread]
Re: small Q
jt wrote in message <398EA566.8AB90683@dial.pipex.com>...
>Hi all,
> I've looked in the DRM for this and not found it.
>
>In a statement like
>
> let (x, y) = values (y, x)
>
>what is being returned by the 'values' function? What sort of structure
>is it? Or is it merely a shorthand for something that the compiler
>unfolds into a sequence of individual assignments?
'values' is returning two values on the call stack. It's not
returning a structure.
Think of the following two as equivalent.
let x = y;
let (x) = values(y);
Go back and read that thread about continuation, because it actually
turns out to be relevant. In CPS, passing [multiple] parameters is
exactly analagous to returning [multiple] values. Multiple return values
is one of those things that, once you use them, you can't imagine why
all languages don't have them. That, and keyword (named) parameters.
Follow-Ups:
References:
- small Q
- From: jt <gkt37@dial.pipex.com>