RFE: Allow newline when returning an anonymous object
cowwoc at bbs.darktech.org
Wed May 28 11:23:09 PDT 2014
Oliver Hunt-2 wrote
>> On May 28, 2014, at 11:10 AM, cowwoc <
> cowwoc at .darktech
> > wrote:
>> I would like the specification to also allow the following syntax:
>> key: "value"
> This is currently valid syntax, and has an entirely different behaviour
> (and side effects) from returning an object literal. This means that even
> if we wanted to we could not change that behaviour without potentially
> breaking existing content.
> That said our reason for the required newline is that it provides a
> mechanism to disambiguate the grammar and semantics of object literal vs.
> block statements.
> The following for instance has totally different behaviour depending on
> whether the new line is used:
> if (foo)
> L: print(something)
> The only way to disambiguate this in the general case is to have a rule
> such as
> <no newline>
> to allow us to be sure that the opening brace is in an expression context
> and not a statement.
Excuse my ignorance, but can you explain (or point me to a layman
explanation) of the difference between the two forms?
View this message in context: http://mozilla.6506.n7.nabble.com/RFE-Allow-newline-when-returning-an-anonymous-object-tp316480p316482.html
Sent from the Mozilla - ECMAScript 4 discussion mailing list archive at Nabble.com.
More information about the es-discuss