Importing typetraits solved the problem. I would have a related question.

Since I want to store the type name on the first call for that type, and since 
I cannot store the string itself because it will be stored on the shared heap, 
I assume I have to use the cstring. The manual says:

"Even though the conversion is implicit, it is not safe: The garbage collector 
does not consider a cstring to be a root."

So I cannot keep/store the cstring directly either. Will this do the job 
correctly? 
    
    
    proc copyCString(s: cstring, len: int): cstring =
      result = cast[cstring](allocShared(len+1))
      copyMem(cast[pointer](result), cast[pointer](s), len+1)
    
    let s = "abc"
    echo copyCString(s.cstring, len(s))
    

Reply via email to