2 ms·
> It is not legal JS as of January 2019. Ah, true. I keep forgetting class fields are not standardized yet since eve ryone is using them anyway just because th
by dmitriid 8y ago
> It is not legal JS as of January 2019.
Ah, true. I keep forgetting class fields are not standardized yet since eve ryone is using them anyway just because they are so damn handy.
> Even if your definition of `x` generated an attribute of instances of C, using an arrow function would defeat your apparent intention: arrow functions take their surrounding lexical scope's `this`, which in this case is the class, not any instance you define from the class.
For the current implementations of class fields this works. If they change that behaviour, what good are classes?
- randallsquared 8y ago> If they change [arrow functions taking `this` from lexical scope instead of caller], what good are classes? Using an arrow function on a class field seems like a way to get static methods that are still callable from the instance. But I'm not sure I have a burning need for that at the moment...