It appears that you can't echo a ref object for some reason. I ran across this 
while going through _Nim in Action_, and in section 3.5.3 there's some code 
that has you echoing a ref object and it doesn't compile for me. Wondering if 
this is a recent change to the language? I'm using v0.15.2 on Windows.

Here's a simple example:
    
    
    type
      ClientObj = object
        name: string
        id: int
      
      ClientRef = ref ClientObj
    
    var clientObj = ClientObj(name: "dude", id: 5)
    echo clientObj # Works just fine
    
    var clientRef = ClientRef(name: "dude", id: 5)
    echo clientRef # Error: type mismatch: got (ClientRef)
    

I guess this means there's no $ operator that can handle ref types... but it 
seems like if it can convert the regular object to a string, why not the ref 
version?

Thanks! 

Reply via email to