I need your macro knowable!

Say I have two functions:
    
    
    proc foobar(x: string): string =
      discard
    
    proc foobar(x: int): int =
      discard
    
    
    Run

I can get the a `ClosedSymChoice` of the `foobar(string)` or `foobar(int)`. To 
get `foobar(int)` I can just pick the 2nd one:
    
    
    macro choose(f: typed) =
      echo f[1].getImpl.treeRepr
    choose(foobar)
    
    
    Run

But what if I don't know the order? How to get the `foobar(int)` specifically? 
Some thing like this:
    
    
    # does not work:
    macro choose(f: typed) =
      echo f.getImpl.treeRepr
    choose(foobar(int))
    
    
    Run

Or maybe?
    
    
    # does not work:
    macro choose(f: typed) =
      echo f.getImpl.treeRepr
    choose(foobar[int])
    
    
    Run

I can go the hacky way and call it with a type, then get it out of the Call 
statement:
    
    
    macro choose(f: typed) =
      echo f[0].getImpl.treeRepr
    choose(foobar(0))
    
    
    Run

But what if the type `int` and instance `0` is more complex then and integer, 
and its hard to create a default version of?

Is there a way to select `foobar(known-type)` version directly?

Thanks!

Reply via email to