HaxeFoundation / HaxeFoundation/haxe
@:structInit meta callback argument
Open
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
Since constructor does not exist at build macro stage, I want to suggest callback arg, that will be called at the end of generated constructor, so you don't need to write constructor signature just to init some complex fields.
```haxe
@:structInit(init)
class Foo {
public var a = 0;
public var b = 0;
public var sum:Int = null;
inline function init() {
this.sum = a + b;
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.