On Apr 1, 2012, at 12:34 AM, Axel Rauschmayer wrote:
>>> Ah, good. But one can use the above (pseudo-)desugaring to predict the
>>> behavior of arrow functions, right? That is, there is no observable
>>> difference.
>>
>> There is, again, the difference in terms of delegation to the target's
>> [[Construct]] in case of a bound function, see the spec ("bound" per ES5, of
>> course, since, as Brendan notices, it's not just a syntactic sugar, but a
>> new special type of functions).
>
> OK. Ignoring [[Construct]] and .prototype, any other differences?
Well, "ES5-bounds" also do not have `prototype' property, but delegate to the
target's `prototype'. However, yes, there is the (main) difference in respect
of supporting TCP (if I understand correctly, since had no time to follow the
complete thread) -- return and break/continue jumps to the parent frame instead
of working with the function itself.
Lexical `this' is the only similar thing to bound functions, so we should not
call => functions as synonym to bound functions. You may say, => function _as
well as_ a bound captures `this' lexically, but in contrast with it, it has
other features. In my later analysis, I'll specify them as a new type of
functions -- AF (Arrow Function) -- in addition to FE, FD, NFE, BF, etc., with
many own features, but not just a syntactic sugar -- neither for FE, nor for BF.
Dmitry
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss