RFE: Allow newline when returning an anonymous object
cowwoc at bbs.darktech.org
Wed May 28 12:01:42 PDT 2014
On 28/05/2014 2:59 PM, Tab Atkins Jr. wrote:
> On Wed, May 28, 2014 at 11:51 AM, cowwoc <cowwoc at bbs.darktech.org> wrote:
>> Wow, what a mess. I've been pretty methodical about semicolons in my code so
>> I forgot about this "feature" :)
>> I'm not a fan of ASI, but in light of your example I agree there is
>> ambiguity. Thanks for the clarification.
> Remember the general rule: semicolons are always automatically
> inserted at the end of lines *unless* doing so would cause a syntax
> error on that line or the next.
> That's why, for example, you can break method chains across lines on
> either side of the period:
> because a semicolon between the lines would cause a syntax error in
> either. But blocks/object literals are different, so you need to
> start the object literal on the first line.
That's a good/simple explanation. Thank you! :)
More information about the es-discuss