`compiles` takes an expression argument, not a string argument. I myself don't 
know a way to do this other than to do something like:
    
    
    import macros, times, tables
    
    macro m(o: typed): untyped =
      let oti = getTypeInst(o)
      let s2 = oti.toStrLit.strVal
      let s2ident = newIdentNode(s2)
      
      echo s2
      result = quote do:
        when declared(tables.`s2ident`):
          static: echo "tables.", `s2`
        elif declared(times.`s2ident`):
          static: echo "times.", `s2`
    
    var x: times.DateTime
    
    m(x)
    

Reply via email to