I ended-up blending both your answers in the example:
    
    
    proc ptest(pid: int): bool {.procvar.} =
      echo "foo",$pid
      return if pid == 100: true else: false
    
    type ProcType = proc (pid:int): bool {.gcsafe, locks: 0, nimcall.}
    var proc_list = newSeq[tuple[id:int; myproc: ProcType]]()
    
    proc_list.add((0,ptest))
    proc_list.add((0,ptest))
    proc_list.add((0,ptest))
    
    echo proc_list[0][1](100), "\n"
    echo proc_list[1][1](200), "\n"
    echo proc_list[2][1](300)
    

For my real code, the macro which generates and populates proc_list is now 
simpler, and works again. Less AST to create. Thanks!

Reply via email to