Re:Nim 1.0
by thsealienbstrds on Wednesday September 25, 2019 @09:03AM
(#21070332)
> In one of my projects I use a macro to parse a set of types for fields and generate constructor macros for them.
Funny, I did a similar thing! :)
You can do that in Nim in a readable way.
Surprisingly I've actually used this kind of thing!In one of my projects I use a macro to parse a set of types for fields and generate constructor macros for them.
The generated constructor macro passes through the parameters it's given to the default built-in constructor but does some setup before.
The final generated code is a normal built-in construction without proc calling yet with special fields initialised automatically.