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

Faisal Vali faisalv at gmail.com
Sun May 15 13:49:56 PDT 2011


Could I trouble you to confirm or clarify the semantics of the
following constructs*:

let f = -> -> 3; // well-formed?

let x = f()();  // x is equal to 3 right?

let global = this;

let o = {};
o.fat  = => this;
o.thin = -> this;

assert( o.fat() === global);  // true?
assert( o.thin() === o); // true?

o.thin_then_fat = -> => this;
o.fat_then_thin = => -> this;


assert(o.thin_then_fat()() === o); // true?
assert(o.fat_then_thin()() === global); // true?

Thanks!

*(based on the arrow syntax proposal
http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax)


More information about the es-discuss mailing list