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

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



Please forget I ever mentioned dropping the TCO requirement.

On Sun, Jan 6, 2013 at 10:11 PM, Jussi Piitulainen <jpiitula@x> wrote:

> The tail call is an orthogonal issue, let's please forget it.

Surely it's not an orthogonal issue. The values of an _expression_ in a
tail position are passed to the continuation. But as I said, I'm fine
as long as I can have the bounded-space behaviour.

You're still confusing the implementation with the specification.  

All that TCO guarantees is that you won't run out of space.
There are many ways to guarantee this.

Consider an implementation which translates when to

  (if test (begin expr ... (if #f #f)))

when the implementation uses Cheney on the MTA plus
an optimization to compact chains of continuations passing
constant unspecified values to just pass the final value.
This will never run out of space.

Moreover, there's a difference between something being
always implied in practice and being required by the
specification.  If the standard leaves the result of when
unspecified, compilers are free to optimize:

  (when test
    (foo)
    (expensive-referentially-transparent-computation))

to just

  (when test
    (foo))

but are not free to do so if we specify the result.

-- 
Alex

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