How can I pass a type through a macro to instantiate a proc with the given type?

Heavily reduced from my real code, I end up with something like this:
    
    
    import macros
      
      proc bar[T]() =
        var a: T
        echo "T=", typeof(a)    # <-- T=NimNode, but want int
      
      macro foo(T: typedesc): untyped =
       bar[T]()
      
      foo(int)
    
    
    Run

I

Reply via email to