-
Notifications
You must be signed in to change notification settings - Fork 27
Access from this should be supported #62
Comments
In your first example, there's In the second example, since there's no conflict between class Foo {
static get flag() {}
flag() {}
} so it'd be very confusing imo if your second example errored. |
if it's a "static" property it should never be accessible from "this" i would think, the idea of it being static means those properties and methods are not available within the instantiated class thus no "this". |
Hi @earonesty.I didn't understand the problem this issue reports. Do you mind explaining a bit further? |
Let assume we have simple function. var Foo = function () {
console.log(this.flag === undefined); // true
console.log(Foo.flag === 4); // true
};
Foo.flag = 4; So, is this OK if we will change this behavior for classes? The way it should retrieve an access is an explicit access through class Foo {
static flag = 4
constructor() {
// explicit access
// no hidden behavior
// thinking of code review
console.log(this.constructor.flag);
}
} My hope |
@wentout That example will work, as would the better practice of not relying on |
Allowing statics and functions of the same name is currently how the babel plugin works. I suspect this is confusing. IE:
This should work.
This should be a syntax error:
The text was updated successfully, but these errors were encountered: