Expression closures - use-cases for shortcut lambda syntax (blocks)
Steven Johnson
stejohns at adobe.com
Fri Mar 16 10:03:34 PDT 2007
> I don't see the value, except for the 'obfuscated Javascript
> contest'. If you make that many closures in a day, why not bind c-\
> to insert `function` in your editor? I would rather programs were
> easy to read than easy to write, since I spend a lot more time doing
> the former. [Another pet peeve: I wish `!` were spelled `not`. It
> is too easy to overlook.]
+1 on the \-considered-harmful position.
If the desire is to save keystrokes, then we're optimizing for the wrong
prolem.
To be sure, terseness is a desirable quality in code, but never at the
expense of clarity.
>From my position (C/C++/Java-ish background), the terseness is far
outweighed by the sheer "wtf?" factor; I look at the code and try to figure
out why ( is being escaped by \. The sorta-looks-like-a-lambda connection is
(IMHO) gonna be very tenuous to the typical JS programmer.
I find this construct to be extraordinarily hard to read, and it was legal,
would probably try to institute a coding convention on my projects that its
use should be avoided.
More information about the Es4-discuss
mailing list