Re: Proposal for a static constructor and static member variables

2017-01-26 Thread Isiah Meadows
There is this proposal for `static` blocks, which IMHO would fit better with the intent: https://github.com/littledan/proposal-class-static-block Class initialization isn't the same as object initialization. Classes are only initialized once, and parameters don't make sense, so it doesn't make

Re: Proposal for a static constructor and static member variables

2017-01-26 Thread T.J. Crowder
It's an interesting idea and certainly some other languages (Java, C#), have static constructors; others (C++) have lived without. I don't recall the runtime details for C#, but certainly Java defers calling static constructors until actually initializing the class, which is indeed later than

Re: Proposal for a static constructor and static member variables

2017-01-25 Thread Reinis Ivanovs
Having a static constructor makes things more confusing, since now static and instance constructors would need to be differentiated, and its value is kind of unclear. Your example also doesn't make sense, since you're accessing the static properties from the instance constructor using `this`,

Re: Proposal for a static constructor and static member variables

2017-01-25 Thread Brandon Andrews
The public one is the one I was thinking of when I said it shouldn't conflict. (I don't see the private spec going anywhere to be honest with that syntax, but if it does that would be interesting). As for the conversion, yes that would be a good conversion for the first example. In the second

Proposal for a static constructor and static member variables

2017-01-25 Thread Brandon Andrews
The initial proposal for discussion is below: https://github.com/sirisian/ecmascript-static-constructor I don't believe this conflicts with other proposals yet, nor any future proposals. Essentially it adds static members in a very compact syntax with minimal grammar changes required. What I