HaxeFoundation / HaxeFoundation/haxe

Omitting function body when overriding @:coreApi classes.

Open
#3,285 17 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

While working on splitting `haxe.io` stuff, I once again came to think that it would be useful to be able to omit function body for non-extern @:coreApi classes which would mean that function body is copied from the common class.

For example:

Comon `haxe.io.Input`

``` haxe
class Input {
public function readByte() : Int {
throw "Not implemented";
}

public function readInt8() : Int {
var n = readByte();
if( n >= 128 )
return n - 256;
return n;
}
}
```

Target-specific `haxe.io.Input`

``` haxe
@:coreApi class Input {
public function readByte() : Int {
return someImplementation();
}

public function readInt8() : Int; // use the same algorithm
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.