Brandon Andrews (2017-01-26T06:37:42.000Z)
warcraftthreeft at sbcglobal.net (2017-01-26T06:48:14.530Z)
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 example putting things outside places them in a different scope. Imagine you had multiple classes defined and they had their own instances member. As for static constructors a more contrived example would be a memoization operation where one does initial work or generation in the static constructor rather than initialization. ``` class MathLibrary { static table = {}; static constructor() { // Common cases for (let i = 0; i < 100; ++i) { MathLibrary.table[i] = // something complex and time consuming } } static Calculate(x) { if (MathLibrary.table.hasOwnProperty(x)) { return MathLibrary.table[x]; } else { let complexCalculation = // something complex and time consuming MathLibrary.table[x] = complexCalculation; return complexCalculation; } } } ``` > Keep in mind that if something is a "static" in the ES6 class method sense, you will never be able to do `this.instances` to get it because the property does not live on `this`, it lives on the constructor. I'll have to think about that. Might need another proposal. I always like to think about static methods and variables as being shared among all instances. Would be nice to get that kind of meaning also. Essentially aliases. Accessing static methods inside of a instance methods requires using the type name which I find less than ideal. Probably a personal preference though.
warcraftthreeft at sbcglobal.net (2017-01-26T06:47:39.230Z)
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 example putting things outside places them in a different scope. Imagine you had multiple classes defined and they had their own instances member. As for static constructors a more contrived example would be a memoization operation where one does initial work or generation in the static constructor rather than initialization. ``` class MathLibrary { static table = {}; static constructor() { // Common cases for (let i = 0; i < 100; ++i) { MathLibrary.table[x] = // something complex and time consuming } } static Calculate(x) { if (MathLibrary.table.hasOwnProperty(x)) { return MathLibrary.table[x]; } else { let complexCalculation = // something complex and time consuming MathLibrary.table[x] = complexCalculation; return complexCalculation; } } } ``` > Keep in mind that if something is a "static" in the ES6 class method sense, you will never be able to do `this.instances` to get it because the property does not live on `this`, it lives on the constructor. I'll have to think about that. Might need another proposal. I always like to think about static methods and variables as being shared among all instances. Would be nice to get that kind of meaning also. Essentially aliases. Accessing static methods inside of a instance methods requires using the type name which I find less than ideal. Probably a personal preference though.