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

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



Hi Alex,

On Sun 06 Jan 2013 03:34, Alex Shinn <alexshinn@x> writes:

> On Sun, Jan 6, 2013 at 4:31 AM, Andy Wingo <wingo@x> wrote:
>
>     as the last expression [of an `and' 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.

I agree it's probably a mistake in practice, but I think that there's no
way you can avoid reducing (or #f (foo)) to (foo) -- and in that case
all values returned from the call to (foo) are returned.

>     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."

I used to agree with you, but requiring the consequent to be in tail
position means that the last expression is evaluated in the continuation
of the "when" expression as a whole.  I don't think you can get around
this with a special "this is unspecified" exception -- you've already
specified it.  Is there any definition other than (if TEST (begin
CONSEQUENT ...)) that actually fits the requirements?

Andy
-- 
http://wingolog.org/

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