You were on the right track, you can just use a macro for this and it makes it 
so much simpler. 
    
    
    import std/[macros]
    
    macro createProc(name, body: untyped): untyped =
      result = newProc(ident("auto" & $name.baseName), body = body)
    
    createProc foo:
      echo "I am in foo"
    
    auto_foo()
    
    
    Run

Reply via email to