proper tail calls
brendan at mozilla.org
Tue Jan 22 11:41:48 PST 2008
On Jan 22, 2008, at 11:27 AM, Thomas Reilly wrote:
> Depends on what you mean by meaningful stack trace. Do you actually
> want to see the same function name repeated N times for each
> I would think not, I would just come up with some notation to decorate
> the stack trace.
Tail call != recursion. Not even indirect recursion. The point is you
may see gaps in the stack where control seems to flow from f to g,
but nothing in tail position in f could possibly call g, and you
wonder what might have intervened.
> Its probably important to go back to Brendan's point about this
> being a
> feature and not an optimization. Even in Java the stack traces you
> are very distantly related to the actual code running when all the
> inlining, escape analysis, and traditional optimizations are applied.
> They jump through a lot of hoops to give you that valuable stack trace
> in spite of all those optimizations and ES4 implementation will
> have to
> do the same.
This is a good point, but the standard may have little to do with it
(we have no standard backtrace methods or properties on Error objects
proposed at this point). The ControlInspector could be used by
programmers, but it is not mandated as part of the spec to help hide
PTC or other transformations. This leaves implementations to compete
on quality of debugging and tracing, which is likely to be a growth
More information about the Es4-discuss