If you want to split a big macros in multiple macros the easiest way to do that 
is to use a `var MyTable: Table[string, NimNode] {.compileTime.}` that will 
collect code fragment from one macro to another.

Simple example to transfer data between 2 macros when a `seq` suffices at:

  * Parsing: 
[https://github.com/mratsim/constantine/blob/2f839cb1/constantine/config/curves_parser.nim#L115-L117](https://github.com/mratsim/constantine/blob/2f839cb1/constantine/config/curves_parser.nim#L115-L117)
  * Code generation: 
[https://github.com/mratsim/constantine/blob/2f839cb1/constantine/config/curves_parser.nim#L227](https://github.com/mratsim/constantine/blob/2f839cb1/constantine/config/curves_parser.nim#L227)



More complex but still simple example: 
[https://github.com/mratsim/Synthesis/blob/b8fdd103/synthesis/factory.nim#L77](https://github.com/mratsim/Synthesis/blob/b8fdd103/synthesis/factory.nim#L77)
 All macros are updating the `Registry` object and the one that does the final 
code generation just read from it this way there is no interleaving.

Maybe I should call that the `Registry` pattern. 

Reply via email to