Why does the first example below not work?
    
    
    ## First example
    type ProcSimple = proc(x:int)
    proc doSimple(x:int) {.procvar.} =
       echo "ran ok"
    
    var b:tuple[a:ProcSimple,b:ProcSimple]
    b = (a:doSimple,b:doSimple) ## Error: Mismatch
    b.a(0)
    

The following is my workaround, by wrapping a procvar in a variable which is 
then used to create the tuple. 
    
    
    ## Second example
    type ProcSimple = proc(x:int)
    proc doSimple(x:int) {.procvar.} =
       echo "ran ok"
    
    var b:tuple[a:ProcSimple,b:ProcSimple]
    var procRef:ProcSimple = doSimple ## this seems silly
    b = (a:procRef,b:procRef)
    b.a(0)
    

Reply via email to