I'm trying to write a proc that returns the same integer ID, when called with 
the same type, from any thread (ID can change on every run). Since, AFAIK, I 
cannot hold/store a typedesc, I thought I would use it's name (or, more 
precisely, a cstring of it's name). But even just getting the name seems 
impossible. Without the name, how can I differentiate the types? Here are few 
things I tried:
    
    
    proc test1*(T: typedesc) = # OK
      echo("ok") # OK
    
    test1(int) # OK, because it doesn't even use T!
    
    proc test2*(T: static[typedesc]) = # OK
      echo(T.name) # OK
    
    test2(int) # COMPILE ERROR
    
    proc test3*(T: typedesc) = # OK
      echo(T.name) # COMPILE ERROR
    
    test3(int) # OK
    

Reply via email to