On May 9, 2011, at 2:21 AM, Irakli Gozalishvili wrote:
> On Monday, 2011-05-09 at 11:02 , Kyle Simpson wrote:
>
>> Isn't that the spirit of what => would give us?
>>
> Yes and this case makes following example extremely confusing:
>
> MyObject.prototype.bar = #(x) { this.bar = x }
>
> Is this instance of MyObject ? So we need to use `#` in some places, but in
> other cases we need to stick to long form `function`. I think `->` and `=>`
> is way more intuitive and simple.
Exactly. Beyond the CoffeeScript precedent (pave the cowpaths) there is the
EIBTI Python dictum. We should not add a shorthand for function that materially
differs in semantics. Alex Russell argued this point with respect to # freezing
and joining (that is, uniting object identity up to the nearest relevant
closure). It applies to |this|-binding too.
It is hard to beed => for "lexically bound |this| function" vs. -> for
"dynamically bound |this| function". I've tried. Any form that defaults to
lexical-|this| and looks like a function from (...){...} on is going to mislead
programmers, exaclty as you show above.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss