HaxeFoundation / HaxeFoundation/haxe

@:structInit meta callback argument

Open
#11,287 2 comments 1 reaction 0 assignees View on GitHub
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

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.