Gavin Barraclough wrote:
On Mar 7, 2012, at 8:35 AM, Rick Waldron wrote:
Honestly, I'm starting to believe that most nay-sayers would get over block-lambda looking weird at
first and learn to really love the benefit it provides. Sure they might say "it looks really
bizarre", but they will also say "remember when we had to assign var that = this; or use
bind()? The dark ages!! I love block-lambda!"
I think there are more valid criticisms than the bizarre look alone. The block
lambda syntax has the unintuitive restriction that only a subset of expressions
may be used in an initializer:
{|a = b&c| a} // valid
{|a = b&&c| a} // invalid
(This arises from the rule "BlockParameterInitialiser : =
BitwiseXorExpression", from
http://wiki.ecmascript.org/doku.php?id=strawman:block_lambda_revival).
The obvious workaround: parenthesize. This is arguably small potatoes
given parameter default values being new.
Using '|' to wrap arguments is problematic, given its existing usage within the language.
There is a real advantages to a proposal that wrap arguments in parentheses, such as
"optional function" based ones on this thread.
But (modulo separate "do" TCP proposal of yesterday) shorter function
syntax is just syntax. No TCP, no lexical |this| in particular.
Just replying to try to assign weights. The | vs. pdv issue is small
IMHO. The incommensurate nature of block-lambdas vs. shorter functions
hangs on TCP, which is big (bigger, anyway).
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss