optional "function" keyword

Gavin Barraclough barraclough at apple.com
Wed Mar 7 11:41:08 PST 2012


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).

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.

cheers,
G.


More information about the es-discuss mailing list