[R6RS] multiple-value binding

dyb at cs.indiana.edu dyb at cs.indiana.edu
Thu Mar 2 01:40:44 EST 2006

> How would that work, though?  I was assuming something like this 
> wouldn't be permitted:
>    (let foo ((a 0)
>              ((values b c) (values 1 2)))
>       ...)
> If it were permitted, would it be called using (foo x y z), or the more 
> semantically startling (foo x (values y z)) [surely not], or am I just 
> suffering from "confusion about how the procedure bound to the name is 
> called"?

I think (foo x y z) is the only viable choice and, yes, you've confirmed
my suspicion that there might be confusion if we allow named let forms
to have values clauses.

> The root issue here seems to be that the longstanding, rather profoundly 
> simple mapping between LET and LAMBDA has been compromised.

Right.  That's what I meant by "gumming up let".

> For the name, how about let/v and let/v* ?  Or variations, like let-v or 
> let/mv.  I don't think that being explicit about the "m" is necessary, 
> though.

Well, these are short but don't fix the *-placement problem.  let/v*
has the same problem as let-values* in that the * isn't really in the
right place, and let*/v is just as ugly as let*-values, if not more so.
The same goes for let-v* and let*-v and for let/mv* and let*/mv.

> I have a question about the overall rationale here: with an alternate 
> form like mvlet, which is designed to support both single and multiple 
> values well, should the original LET end up being deprecated (except for 
> the named let form)?  After all, mvlet will have the same syntax as LET, 
> for single values.  Alternatively, should they be considered coequal, 
> intended to support two different programming styles?  While we may not 
> get to decide what happens in practice, we may want to explain what is 
> intended.

The syntax is not the same for single values.  To bind a single value
with mvlet, you need to wrap the variable in parens, like this:

  (mvlet ([(x) e]) ---)

I would not want to deprecate let in any case because of its simplicity
and close relationship with lambda.  In fact, I'd like to see let in
the core language and mvlet in a library.


More information about the R6RS mailing list