import macros
    
    type
      S = string
      I = int
      O = object
        i: int
      P = ref O
    
    var i: I
    var s: S
    var p: P
    var o: O
    
    macro mconnect(arg: typed): typed =
      let at = getType(arg)
      echo $(at.toStrLit)
      if at.len > 1:
        echo $(at[1].toStrLit)
    
    mconnect(s)
    mconnect(i)
    mconnect(p)
    mconnect(o)
    

Output is
    
    
    Hint: macros [Processing]
    string
    int
    ref[O]
    O
    object
      i
    
    

How can I get P instead of ref[O] and O instead of object i ? I need that for a 
cast in gtk connect macro. (I think I may get what I need when I use type() 
outside of the macro and pass the result as an additional parameter to the 
macro. But I had the feeling that getType() can do it also?)

Reply via email to