I think I've found a solution that will work for me (still working through all the details):
I define `mkParser` and `flag` as `{.compileTime.}` procs. Then when I want to make a command line parser, in my application code, I define and use a macro like this: macro makeParser(): untyped = return mkParser("some name"): flag("-a") flag("-b") var p = makeParser() Run I think it would be cool if Nim supported doing stuff like this without the wrapping macro syntax, but it's way cool that Nim supports this at all!