[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 7:15 PM, Andy Wingo <wingo@x> wrote:
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?

It's not particularly useful to use when/unless in tail context
anyway, so I think we should just remove these from the list
of tail calls.

But if we do keep it, I see no contradiction stating that the
body is a tail context but the result unspecified.


Scheme-reports mailing list