Re: RFE: Allow newline when returning an anonymous object

2014-05-28 Thread Oliver Hunt
On May 28, 2014, at 11:10 AM, cowwoc cow...@bbs.darktech.org wrote: I would like the specification to also allow the following syntax: return { key: value }; This is currently valid syntax, and has an entirely different behaviour (and side effects) from returning an object

Re: RFE: Allow newline when returning an anonymous object

2014-05-28 Thread cowwoc
On 28/05/2014 2:33 PM, Oliver Hunt wrote: On May 28, 2014, at 11:23 AM, cowwoc cow...@bbs.darktech.org mailto:cow...@bbs.darktech.org wrote: if (foo) return { 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

Re: RFE: Allow newline when returning an anonymous object

2014-05-28 Thread Brendan Eich
Oliver Hunt wrote: What you're asking for is grammatically ambiguous in a way that would potentially break existing content, and (generally) leads to really interesting parsing behaviour. As Doug Crockford has argued, this is why KR style is better in JS: always put the { at the end of the

Re: RFE: Allow newline when returning an anonymous object

2014-05-28 Thread Oliver Hunt
On May 28, 2014, at 11:39 AM, cowwoc cow...@bbs.darktech.org wrote: Don't we use a semicolon to denote the end of an expression context? Perhaps I'm missing something, but I see no ambiguity in the example you gave. I expect: return {}; and return {}; to return an

Re: RFE: Allow newline when returning an anonymous object

2014-05-28 Thread cowwoc
On 28/05/2014 2:42 PM, Brendan Eich wrote: Oliver Hunt wrote: What you're asking for is grammatically ambiguous in a way that would potentially break existing content, and (generally) leads to really interesting parsing behaviour. As Doug Crockford has argued, this is why KR style is better

Re: RFE: Allow newline when returning an anonymous object

2014-05-28 Thread Oliver Hunt
On May 28, 2014, at 11:48 AM, cowwoc cow...@bbs.darktech.org wrote: That's an unfortunate side-effect. I think that developers should be able to pick their own code styles. After all, most of these choices are subjective. Anyway, thanks for the head's up. They can choose their own

Re: RFE: Allow newline when returning an anonymous object

2014-05-28 Thread cowwoc
On 28/05/2014 2:43 PM, Oliver Hunt wrote: On May 28, 2014, at 11:39 AM, cowwoc cow...@bbs.darktech.org wrote: Don't we use a semicolon to denote the end of an expression context? Perhaps I'm missing something, but I see no ambiguity in the example you gave. I expect: return {}; and

Re: RFE: Allow newline when returning an anonymous object

2014-05-28 Thread Tab Atkins Jr.
On Wed, May 28, 2014 at 11:51 AM, cowwoc cow...@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.

Re: RFE: Allow newline when returning an anonymous object

2014-05-28 Thread cowwoc
On 28/05/2014 2:59 PM, Tab Atkins Jr. wrote: On Wed, May 28, 2014 at 11:51 AM, cowwoc cow...@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

Re: RFE: Allow newline when returning an anonymous object

2014-05-28 Thread Brendan Eich
Oliver Hunt wrote: That's an unfortunate side-effect. I think that developers should be able to pick their own code styles. After all, most of these choices are subjective. Anyway, thanks for the head's up. They can choose their own style, just not their own syntax. Right, and syntax can