HaxeFoundation / HaxeFoundation/haxe
genericBuild limitation
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
We're trying to create a `Partial` type for `typedefs`; there is a macro that work https://gist.github.com/haxiomic/ad4f5d329ac616543819395f42037aa1 for concrete cases:
```haxe
// works
typedef State = { a:Int, b:String };
var foo:Partial;
foo = { a:10 };
```
However it does not work in "recursive" generic scenarios because, the `genericBuild` runs against `T` and not with each parent generic type:
```haxe
// fails because Partial's genericBuild receives T instead of State
typedef State = { a:Int, b:String };
class Base {
function setState(state:Partial) {...}
}
class Foo extends Base { ... }
```
We probably need to improve `genericBuild`, but I'd rather have a language built-in `Partial`.
Contributor guide
Assessment
This issue has not been assessed yet.