You're right, there might be better solutions here than a macro - this was just a quick porting of a Go code to Nim, and I was thinking of C preprocessor macros, so ...
But about the macros, I am pretty intrigued by but so far I don't understand them.. found some tutorials but so far no 1:1 macro -> expanded code samples out of which I'd learn best..