Email list hosting service & mailing list manager


Re: [srfi-11] LET-VALUES wrapup (was: Re: Another vote for more parens) Lars Thomas Hansen 10 Jan 2000 20:20 UTC

>Okay, here's a summary of the proposal I see coming down the bend
>(note that I don't like it, I'm just summarizing it *smile*)...
>
>Syntax:
>
>  EXP ::= (let-values (DECL ...) BODY)
>        | (let*-values (DECL ...) BODY) ;; or let-values*?
>
>  DECL ::= (IDENTIFIER EXP)
>         | (FORMALS* EXP)
>
>  FORMALS* ::= everything that the <formals> nonterminal from R5RS
>               7.1.3 can be, _except_ for just an <identifier>.
>
>Semantics (for just one decl, because I'm lazy)
>
>  (let-values ((IDENTIFIER EXP)) BODY)
>  ==> (let ((IDENTIFIER EXP)) BODY)
>         or, equivalently
>      (call-with-values (lambda () EXP) (lambda (IDENTIFIER) BODY))

Holy cow, absolutely not!

	(let-values ((I E)) BODY)
	==>  (call-with-values (lambda () E) (lambda I BODY))

There is only one case: any <formals> is allowable, and does exactly
what you would expect.  I thought I was clear about this but I guess I
must not have been.  The proposed expansion above is in any case not
allowed by the Report.

There is nothing profound about my spec for LET-VALUES.  It is merely
sugar that aims to improve readability of programs (by removing the use
of CPS introduced by CALL-WITH-VALUES).  Among other things I want to be
able to capture all the returned values in a list.  Mike (and maybe
Dave, I can't tell) wants to perserve the equivalence of (values 1) and
1 when destructuring; I don't mind that, but it competes with the
ability to capture all values, which I value much more highly.

--lars