I am not sure if I am on the right way, but I cam up with this...
    
    
    include "scf.nimf"
    
    echo generateType("Person", @["name", "job", "email"])
    
    
    Run

`scf.nimf`
    
    
    #? stdtmpl | standard
    #proc generateType(class: string,
    #                      fields: openArray[string]): string =
    #  result = ""
      type Person* = object
      #for field in items(fields):
        ${field}*: string
      #end for
    
    
    Run

echo output
    
    
    type Person* = object
      name*: string
      job*: string
      email*: string
    
    
    
    Run

Reply via email to