> I know it's just bikeshedding, but do you need the -> arrow (it is better
> visually)? You can as well take arrowless approach but putting : before
> every parameter (as I suggested):
>
>
>>     // ':' is the clue that this is the start of a short function
>>     coll.map(:x -> x*x) //function(x){ return x*x;}
>>
>       coll.map(:x x*x)


I really don't find this more readable at all - quite the opposite, in
fact. The arrow actually helps visually see whats going on without feeling
noisy. I really feel like either an arrow (fat or skinny, I don't care) or
{} are required.

>
>>        coll.forEach(:x, :i {


multiple arguments in combination with a label would look really funny

      when(promise,
>            ok :result doSomething(result),
>            error :e handleError(e)
>
>       );
>

With the : paired with the param instead of the name, it does not read
well. I don't read the 'ok' as a label for what is to follow, my eyes try
to read the whole thing like a sentence, and fails.


>      //if no parameters or name, can drop the ':'
>>     $("#other").click(->$("#**target").click());
>>
> Ah, here is only problem... the arrow does it nicely when there is no
> parameter. This could work:
>
>       $("#other").click(: $("#target").click());
> and the system is changed so that only first param is colonized ;-)
>

I don't think this is unambiguous, unless you are assuming that there can
be no whitespace between : and the parameter.


> so previous two-param example would be
>       coll.forEach(:x, i {
>
>           if(i%2 === 0){
>               console.log(x + " is " + even);
>           }else{
>                console.log(x + " is " + odd);
>           }
>       });
>
>  I think this should be easy to parse, and I feel like using : keeps it
>> from seeming too foreign.
>>
>
> The rationale for arrowless one was to make trivial ones (where the
> clutter is most visible) as short as possible. :x x*x is one example.
>

Like I said, something as trivial as this has plenty of room for an arrow,
which I think improves readability. We got rid of 'function()' {}'s and
'return' - isn't that enough?

- Russ
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to