Hey and thank you! I am aware of the weirdness of the thing I am trying to achieve, but happy to see that there is at least some other person doing something similar. :)
Your understanding about record calls is perfect; that is exactly how it works. The issue is actually that app.nim is imported by all record definers as those generated constants in app.nim are used in the generated procedures in record defining modules. For that, app.nim gets called first. What I do currently, i.e. a two-pass compilation works perfectly to achieve the end result I want. A better (future) solution would be importing the compiler itself and having a custom compilation process for this. A midway solution can be just using the legacy option and not worrying about type checking the modified AST since all the added statements are just constant definitions where I am already sure about the type correctness. I was just wondering if there is already a way to do this, hence this post. Also, I now just wonder if it would work if I make the type for app macro typed and record for untyped. I haven't tested this yet, since I already changed the whole process to generate a nim file and this possibility only occurred to me in the last half hour, but it seems like a good idea. Compiler probably runs macros in two phases first untyped ones and then typed ones. :D Thank you again for the kind welcome and informative answer!
