arrow functions and dart

Salvador de la Puente González salva at unoyunodiez.com
Tue Sep 23 01:30:36 PDT 2014


Proposal:

x, y : x*y;

or...

x, y : { //body... }

or the sharp alternative from Brendan [1]

#(x, y) { body... }

I find first option very interesting as it is very tiny for simple lands
lambdas but allowing bigger bodies and with non ambiguous syntax.

[1] http://brendaneich.com/2011/01/harmony-of-my-dreams/
On 23 Sep 2014 00:38, "Matthew Robb" <matthewwrobb at gmail.com> wrote:

> I think it's also worth noting that CoffeeScript uses an arrow as well and
> it doesn't seem to impact usability much if at all.
>
>
> - Matthew Robb
>
> On Mon, Sep 22, 2014 at 6:19 PM, Rick Waldron <waldron.rick at gmail.com>
> wrote:
>
>>
>>
>> On Mon, Sep 22, 2014 at 5:18 PM, Francisco Ferreira <
>> francisco.m.s.ferreira at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Just to set some expectations, Although I follow es-discuss, I read more
>>> than I discuss. So the point I want to achieve with this e-mail is:
>>>
>>> I have played with dart since it was in alpha. And I also have been
>>> coding with --harmony for a while. I would like to comment that arrow
>>> functions in dart are much better than in ES6 (mozilla implementation).
>>>
>>> Let's compare
>>>
>>> In JS:
>>> anObject.thatGetsACallback( (arg1, arg2) => { .... } );
>>>
>>> In dart:
>>> anObject.thatGetsACallback( (arg1, arg2) { .... } );
>>>
>>
>> Sure, but that syntax cannot be used outside of call expression
>> arguments. I had a proposal in 2011 (
>> https://gist.github.com/rwaldron/961495) that fell down on this hazard:
>>
>> var x = 1;
>> f = (x)
>> { x }
>>
>>
>> ...Which is a valid JavaScript program today, which means that `(params){
>> body }` cannot parse unambiguously.
>>
>> Rick
>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140923/7704695e/attachment.html>


More information about the es-discuss mailing list