Russell Leggett wrote:
    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

For me it feels noisy. :x is automatically "argument x to the function" and I do not need more.

Not to argue, just to show it can be otherwise.

don't care) or {} are required.


           coll.forEach(:x, :i {


multiple arguments in combination with a label would look really funny

I do not see it as a label...


           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.

... but as a paramter(-list)-specifier of the short function. On the contrary to what you write, I read

  add :a, b (maybe ->) a+b

a lot better (sentence-wise), than

  add: a, b (maybe ->) a+b

(xxx: is automatically read as property name in object literal, I feel very uneasy reading it. But hopefully, : placement is not fixed to name with you proposal and can go with (the beginning of list of) parameters.


    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?

Well, not, if it is possible to do nicely. I think, we should first make shortest possible variants, and if they would be too hard to read or implement, to decorate them further.

- Russ

Herby

P.S.: I read :x as "parameter x" because I have some experience with Smalltalk. There, it is readable very fine. For people without that experience, it probably can look strange.

P.P.S.: As I wrote in reply to Brendan's mail, since arrowless variant has serious problems, I'd say ok to your one which is paren-free, using : to delimit parameter list and is pretty short.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to