Rationalizing ASI (was: simple shorter function syntax)
Waldemar Horwat
waldemar at google.com
Mon Jul 26 14:02:29 PDT 2010
Maciej Stachowiak wrote:
> On Jul 25, 2010, at 5:06 PM, Brendan Eich wrote:
>> Mark's restricted production idea is on target, if we think it's worth doing.
>
> At least in C or C++, I've seen code like this:
>
> veryLongObjectName.someOtherVeryVeryLongObjectName.ridiculouslyLongFunctionName
> (longArgument1, longArgument2, longArgument3, longArgument4, longArgument5);
>
> If I understand correctly, Mark's proposal would make that a syntax error in JavaScript. I'm not sure offhand if JavaScript programmers write in this style, or would find the loss annoying. Of course, you could always write this as a single very long line, or make sure that at least the open paren is on the first line, but programmers can be picky about questions of style like this.
If you made function invocation a restricted production then semicolon insertion would turn the above code into:
veryLongObjectName.someOtherVeryVeryLongObjectName.ridiculouslyLongFunctionName;
(longArgument1, longArgument2, longArgument3, longArgument4, longArgument5);
Waldemar
More information about the es-discuss
mailing list