(x) => {foo: bar}
Kevin Smith
zenparsing at gmail.com
Mon Jan 5 12:16:23 PST 2015
Also, I did some analysis on this issue way back when. In the codebases
that I looked at the percentage of "bound this functions" which simply
returned an object literal were quite low.
(See the "%Object Literals" column)
https://docs.google.com/spreadsheet/ccc?key=0Aro5yQ2fa01xdENxUzBuNXczb21vUWVUX0tyVmNKTUE#gid=0
https://docs.google.com/spreadsheet/ccc?key=0Aro5yQ2fa01xdEJySWxhZ1VoZ0VaWTdldXp4NUtJd3c#gid=0
(from https://esdiscuss.org/topic/btf-measurements)
Of course, actually having arrow functions will change the situation to
some degree, but the current tradeoff made sense in light of that evidence.
On Mon, Jan 5, 2015 at 3:06 PM, Brendan Eich <brendan at mozilla.org> wrote:
> Kevin Smith wrote:
>
>>
>> I think hacking around this would not get rid of the footgun, but
>> would just make it more complicated to understand the footgun,
>> personally.
>>
>>
>> My gut reaction is to agree - the current rule, while it takes some
>> trivial learning, is easy to understand and communicate and is reflected
>> well in other parts of the language. Also, additions to object literal
>> syntax might make this more...weird:
>>
>> x => { [abc](def = function() { huh() }) { blahblahblah } };
>>
>> "But it's an object literal, obviously!"
>>
>
> Yes, there's always a trade-off, some futures are foreclosed by syntax
> changes of this sort.
>
> Is it worth it? Hard to say, crystal ball service not answering the phone
> ;-). Still, the motivation for that strawman I wrote in 2011 lives on.
>
> /be
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150105/219b2207/attachment.html>
More information about the es-discuss
mailing list