[R6RS] summary of decisions regarding multiple values

William D Clinger will at ccs.neu.edu
Mon Jun 26 09:44:22 EDT 2006


In preparation for tomorrow's conference call, I thought
it might speed things up if I post the motion I will move
at some point during that conference.

Motion:  The second (alternative) expansion of begin, from
R5RS 7.3, shall be revised for consistency with the rest
of the R6RS, but some such alternative expansion of begin
shall remain in the corresponding section of R6RS.

The rationale for this motion is the same as the rationale
for having the alternative expansion of begin in the R5RS.
By explaining an explicit begin in terms of the implicit
begin of a lambda body, the first expansion explains
nothing at all.  (Its presence in R5RS 7.3 was essentially
a bit of levity.)  The second expansion of begin is what
justifies the classification of begin as library syntax in
R5RS 4.2.3.  That classification is part of the evidence
for the assertion, in the second sentence of the R5RS
Introduction, that "a very small number of rules for
forming expressions, with no restrictions on how they
are composed" has some desirable property.

Here, for example, is an untested expansion I believe to
be consistent with the semantics Kent prefers for multiple
values:

    (define-syntax begin
      (syntax-rules ()
       ((_ exp)
        exp)
       ((_ exp1 exp2 ...)
        (call-with-values
         (lambda () exp1)
         (lambda ignored (begin exp2 ...))))))

                                * * *

Earlier in this thread, I proposed the semantics I prefer
for multiple values.  Today I would like to describe a
second semantics that, like the one I described earlier,
would be consistent with the second expansion for begin
given by R5RS 7.3.

The second semantics, like the first, has the property
that returning zero values to any continuation that
wasn't created by call-with-values would be equivalent
to returning the unspecified value.  It differs from
the first semantics in that a &values exception must be
raised if two or more values are returned to any
continuation that wasn't created by call-with-values.

This semantics would prevent the alleged error of
ignoring extra values, while erasing almost all of the
practical difference between returning zero values and
returning the unspecified value.

Will




More information about the R6RS mailing list