arrow function syntax simplified
axel at rauschma.de
Sun Apr 1 01:45:51 PDT 2012
No, that paraphrases “no TCP, everything behaves like in normal functions”. That is, it describes how return, break, continue currently work in functions.
[[[Sent from a mobile device. Please forgive brevity and typos.]]]
Dr. Axel Rauschmayer
axel at rauschma.de
On 01.04.2012, at 10:40, Dmitry Soshnikov <dmitry.soshnikov at gmail.com> wrote:
> On Apr 1, 2012, at 1:22 AM, Axel Rauschmayer wrote:
>>> 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.
>> Arrow functions do not adhere to TCP. Everything you need to know is here: http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax
> Yes, thanks I've read it. But probably I misunderstood the description, but what then is the following mean?
> "... bind return in the Block body case so it returns from the immediately enclosing arrow function, and preclude breakand continue from referencing statements outside the immediately enclosing arrow function."
> Isn't it for supporting TCP? (sorry if it was already discussed and explained before, that's said, unfortunately hadn't time to join earlier)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss