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

Re: [Scheme-reports] multiple values, and, or, when, unless



On Sun, Jan 6, 2013 at 4:31 AM, Andy Wingo <wingo@x> wrote:
The specification for `and' notes that "If all the expressions evaluate
to true values, the value of the last _expression_ is returned."  This is
not the case: as the last _expression_ is in tail context, the _values_ of
the last _expression_ are returned.  Same with `or', `when', and
`unless'.

Pluralized for `and'.  I'm not sure about `or' - I think it would
always be a mistake to use MVs in an or _expression_.
 
Contrary to their specifications and the "differences from r6rs"
appendix, the return value of `when' and `unless' is indeed specified if
the body is evaluated, as the body is in tail position.

No, this was a mistake on R6RS's part.  It is meaningless
to return values from `when' or `unless', so we explicitly state
that "the result of the when/unless _expression_ is unspecified."

This arguably conflicts, as you point out, with the specification
of these as tail forms.  I think since we can't rule out the
possibility of compiler techniques that allow for unspecified
result tail calls this is not a problem.

The important thing is not to suggest it would ever be
sensible to use the result of a when or unless.

-- 
Alex

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