HaxeFoundation / HaxeFoundation/haxe

Can't bind extern inline function

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

Description

```haxe
class Main {
static function main() {
var f = new Foo();
var v = 1;

var bound = f.bar.bind(v); // Error: Can't create closure on an extern inline member method

// maybe the compiler can generate the following which should be equivalent?
var bound = {
final _f = f;
final _v = v;
function() _f.bar(_v);
}

bound(); // 1
v = 2;
bound(); // 1
}
}

class Foo {
public function new() {}
@:extern public inline function bar(v:Int) {
trace(v);
}
}
```

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.