Interesting. So x => x * x is not just syntactic sugar for

     function (x) { return x * x }.bind(this)

On Mar 29, 2012, at 21:02 , Brendan Eich wrote:

> Brendan Eich wrote:
>> Irakli Gozalishvili wrote:
>>> Few questions on this new arrow functions:
>>> 
>>> let foo = x => x * x
>>> 
>>> 
>>> 1. What is foo.prototype ?
>>> 2. What does new foo(y) does ?
>> 
>> The idea with arrow function syntax (as opposed to block-lambda revival) was 
>> to be as close to "just syntax" for functions. Obviously we've made 
>> early-error restrictions but this design goal still stands. So the answers 
>> are:
>> 
>> 1. Same as for any user-defined function (a fresh Object instance).
>> 2. Same as for any user-defined function. 
> 
> Oops, I left off something important. Since we agreed on lexical |this| 
> binding, there's no way for the new object to flow into the arrow function. 
> So I'm wrong, the answers are:
> 
> 1. Same as for any built-in function: no .prototype property at all.
> 2. Arrow-functions lack [[Construct]] so you cannot 'new' them.
> 
> This makes arrows like built-ins. They're still functions, per my other 
> answers.
> 
> I'll update the strawman (which should be promoted shortly).
> 
> Thanks for the good questions!
> 
> /be
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
> 

-- 
Dr. Axel Rauschmayer
[email protected]

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to