Пример метапрограммирования использованием шаблоно

Run Settings
LanguageNim
Language Version
Run Command
template genType(name, fieldname: untyped, fieldtype: typedesc) = type name = object fieldname: fieldtype genType(Test, foo, int) var x = Test(foo: 4566) echo(x.foo) # 4566
Editor Settings
Theme
Key bindings
Full width
Lines