arrow syntax unnecessary and the idea that "function" is too long

François REMY fremycompany_pub at
Mon May 9 02:19:50 PDT 2011

  Let's ignore popularity level for the moment, no other proposal has analog of `=>` which is a solution for a real problem:

      var self = this;
      function callback() {
Sorry, alternatives were evocated. If you had read my last mail (I know it was a pretty long one so I don’t blame you), you could have noticed that I proposed to use the @-syntax to perform just that. The idea would be that all lambdas would have a “bound” this (which would be the biggest distinctive between them and functions).
The syntax would be the following :
    “@” + ( “(“ + <argument-list> + “)” )? + ( <expression> | <block> )
And it would allow to solve the “this” problem easily :
    element.onclick = @this.removeFromParent();
    setTimeout((@alert(this)), 10); 

alongside with the other common lambda usage :
    firstChilds =;
    array.reduce(@(a,b) { return (a-b)*(a+b); });
In case you need to pass a function that has not a bound this, you should continue to use the “function” keyword as usual :
    var anObjectHasOwnValueOf = { 
        return this.hasOwnProperty(“valueOf”); 
    }, anObject);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list