Hello, guys!

Nim can use anonymous procedures in procedures like map(), filter() and other. 
Is it possible to have procedural return and if yes, how this should be 
formatted syntactically?

Something like this: 
    
    
    proc pprint(annotation: string): proc(t0: T1): T1 =
      # ... some usage of annotation parameter ...
      return proc(val) =
        val
    

This example does not compile, but if one change 
    
    
    proc(t0: T1): T1
    

to 
    
    
    any
    

then it compiles.

Also, for some reason I have to have forward declaration of the same procedure. 
Next line does not compile also and I have no idea how to get it compiled. 
    
    
    proc pprint(annotation: string): proc[T1](t0: T1): T1
    

Reply via email to