Classes: Moving away from object literal syntax

2012-03-21 Thread Axel Rauschmayer
Brendan argued that if you restrict in class declarations what you can do syntactically then basing their syntax on object literals will confuse people. I agree. Based on that and on a recent proposal for a non-braces private syntax, I’ve updated my class declaration proposal:

Re: Classes: Moving away from object literal syntax

2012-03-21 Thread Alex Russell
AFAICT this is a small variation on what was discussed last summer. What am I missing? On Mar 21, 2012, at 8:39 AM, Axel Rauschmayer wrote: Brendan argued that if you restrict in class declarations what you can do syntactically then basing their syntax on object literals will confuse

Re: Classes: Moving away from object literal syntax

2012-03-21 Thread Axel Rauschmayer
Nothing, the changes are minor: It’s just not based on object literal syntax, any more (= instead of : and ; instead of ,). And instead of private { foo }, there is now private foo; On Mar 21, 2012, at 11:28 , Alex Russell wrote: AFAICT this is a small variation on what was discussed last

Re: Classes: Moving away from object literal syntax

2012-03-21 Thread Herby Vojčík
Yeah, they are pushing it hardly this way. It seems inevitable... I am willing to accept it, but I'd like to have a clear mapping from object initializer components into class body components - if it is there, I don't care about syntax (the main concern for me is, that if certain things are

Re: Classes: Moving away from object literal syntax

2012-03-21 Thread Axel Rauschmayer
On Mar 21, 2012, at 12:42 , Herby Vojčík wrote: Yeah, they are pushing it hardly this way. It seems inevitable... I am willing to accept it, but I'd like to have a clear mapping from object initializer components into class body components - if it is there, I don't care about syntax (the

Re: Classes: Moving away from object literal syntax

2012-03-21 Thread Herby Vojčík
Axel Rauschmayer wrote: On Mar 21, 2012, at 12:42 , Herby Vojčík wrote: Yeah, they are pushing it hardly this way. It seems inevitable... I am willing to accept it, but I'd like to have a clear mapping from object initializer components into class body components - if it is there, I don't

Re: Classes: Moving away from object literal syntax

2012-03-21 Thread Axel Rauschmayer
“I think it should have exactly same rules as the basic class block” – I agree 100%. But then you are negating yourself - if you allow it for static but not for prototype, then they are not 100% same... if I can add shared data in static, I should be able to add it to prototype - or vice

Re: Classes: Moving away from object literal syntax

2012-03-21 Thread Brendan Eich
Herby Vojčík wrote: That brings the question: what about static block? I think it should have exactly same rules as the basic class block (sans possibility having its own nested static block). That is, what about that const? Is data allowed in static (const-only or let as well) but not in

Re: Classes: Moving away from object literal syntax

2012-03-21 Thread Russell Leggett
On Wed, Mar 21, 2012 at 1:49 PM, Brendan Eich bren...@mozilla.org wrote: Herby Vojčík wrote: That brings the question: what about static block? I think it should have exactly same rules as the basic class block (sans possibility having its own nested static block). That is, what about that

Re: Classes: Moving away from object literal syntax

2012-03-21 Thread Herby Vojčík
Brendan Eich wrote: Herby Vojčík wrote: That brings the question: what about static block? I think it should have exactly same rules as the basic class block (sans possibility having its own nested static block). That is, what about that const? Is data allowed in static (const-only or let as

Re: Classes: Moving away from object literal syntax

2012-03-21 Thread Axel Rauschmayer
https://gist.github.com/1336846 Makes sense. I removed the static block. I only faintly remember David’s proposal, but I think it’s almost like his “minimal classes” now – IMO a good thing. On Mar 21, 2012, at 18:49 , Brendan Eich wrote: Herby Vojčík wrote: That brings the question: what