Open staycoolcall911 opened 1 year ago
Hi,
This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
Hi,
This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
@yoav-steinberg @staycoolcall911 Do you know if this issue is about static methods or static fields?
I think for static methods it looks like inheritance-like behavior is working as expected (or is at least consistent with behavior from TypeScript):
class Foo {
pub static foo() {
log("foo");
}
}
class Foo2 extends Foo {}
class Foo3 extends Foo {
pub static foo() {
log("bar");
}
}
Foo.foo(); // "foo"
Foo2.foo(); // "foo"
Foo3.foo(); // "bar"
Yeah... I could have been more explicit about what I meant :) I was actually bulk creating issues based on requirements specified in the Winglang language reference. This specific requirement came from here (look for the phrase "statics are not inherited").
We had an offline discussion about this with @yoav-steinberg and some other maintainers - it shouldn't be hard to honor the spec here and add a type check error if you're accessing a static method that wasn't defined on that particular class. That would mean in the code above, Foo2.foo()
should raise an error like No symbol "foo" found on Foo2
. If there are strong use cases for supporting static method inheritance, we can always reverse this in the future without needing a breaking change.
Hi,
This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!