Questions on Proper Tail Calls

Angus Croll anguscroll at gmail.com
Sat Mar 9 18:40:52 PST 2013


Thanks Allen, those are the answers I wanted to hear :)
Seems like ES 6 proper tail calls will be a good for CPS too.


On Sat, Mar 9, 2013 at 5:22 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:

>
> On Mar 9, 2013, at 3:00 PM, Angus Croll wrote:
>
> 1. Will proper tail calls only happen in strict mode, and if not are we ok
> with losing backwards compatibility re. [function].caller and [
> callingFunction].arguments?
>
>
> Apparently yes, there is a note in the draft that we reached that
> conclusion at a TC39 meeting
>
>
> 2. Will tail call behavior apply regardless of the tail call syntax?
> (fn(), fn.call, fn.apply)?
>
>
> yes, assuming that the actual call to fn is in a tail position within the
> call or apply function implementations.  I'll review to spec. to make sure.
>
>
> 3. Will tail call behavior apply even when the tail call is not recursive?
>
>
> yes
>
>
> 4. If function fn has a function call in the tail position and is then
> bound (fn2 = fn.bind(x)),  will fn2 also support proper tail calls? (I
> think this is only relevant if (3) is true)
>
>
> yes, it is only based upon the syntactic structure of the function making
> the call, not it's bindings
>
>
>
> thanks
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130309/057df0af/attachment-0001.html>


More information about the es-discuss mailing list