-
-
Notifications
You must be signed in to change notification settings - Fork 690
Closed
Description
Allowing classes to extend abstracts would be useful:
class Foo {
public function new() {}
public function value():Int { return 1; }
}
abstract Bar(Foo) {
public function new() {
this = new Foo();
}
// Calls to this function look like:
// Bar_Impl_.doubleValue(foo_inst);
public function doubleValue():Int {
return 2 * this.value();
}
}
// In the current version of Haxe, this would throw a compilation error.
// Instead, it should look like:
// class Baz extends Foo
class Baz extends Bar {
public function new() {
super();
}
// This function's body should look like:
// return 2 * Bar_Impl_.doubleValue(this) + this.value();
public function quintupleValue():Int {
return 2 * this.doubleValue() + this.value();
}
// This should work as expected.
public override function value():Int { return 3; }
// This should throw a compilation error:
// Cannot override a function declared in a parent abstract
public override function doubleValue():Int;
}If this is too big of a change to be considered a normal enhancement, let me know and I can draft a HaxeEvolution proposal.
Metadata
Metadata
Assignees
Labels
No labels