COMMUNITY

Macro details

Hej all !
I try to improve my understanding of macros in Haxe. I write macros since 2011, I’m not a specialist but I success to do almost all I want and have a quite good understanding of the basis but I still need to understand some details and how does it work on the background.
For example I would like to detail a bit more this picture, show where exactly occur the different macro contexts (initialization, builds, expressions) and also where exactly occur the callbacks like onTypeNotFound, onAfterTyping, onGenerate, onAfterGenerate, vhere does macro “loop” when creating a new Type that need pass the typer and so on, show on every contexts what can we interract with ( set metas, manipulate fileds…), which kind of exprs and types can we manipulate in order to modify that or that.
I’m also sometimes confused when I deal with exprs and typedExprs, for example when I need to get type of an expr inside a build macro, and return it back (getTypedExpr( typeExpr ) ) I know some things are resolved like usings,imports, getter/setters… but it’s complicated I don’t really know i it’s better to send it to expression macros and deal all in typed mode or can I mix the both ? What is the process inside when doing such a thing please ?
image
Can some people that know very well macros and how does it work in the background explain me (us ?) a bit more please ? Maybe if we can represent that on this scheme but more detailed or another one ? I don’t know…

Thank you very much for your reading,
Regards,
Michal

2 Likes