You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One just has to remember - macro something is just a syntax sugar for creating data structures (Expr, TypeDefinition, ComplexType, etc), so of course if you create macro class {...} that's going to be a TypeDefinition, so you can access its fields normally
I almost always create fields manually, but for exprs I use reification. It doesn't feel right to create a TypeDefinition that will be thrown away later, but OTOH Haxe will inline and eliminate it.
This is awesome and much more readable than creating fields manually for some cases.
Recently found this:
https://github.com/lbergman/GASM/blob/develop/src/gasm/core/macros/ComponentMacros.hx#L37-L52
After some investigation, I heard you can do
(macro class { ... }).fields
.As example it can be reduced to:
Some info from nadako:
This is awesome and much more readable than creating fields manually for some cases.
ref https://haxe.org/manual/macro-reification-class.html
TODO: Make article about this, and/or integrate in those https://code.haxe.org/tag/building-fields.html
The text was updated successfully, but these errors were encountered: