First of all - is there a reason you need raw pointers? Typically you can use 
Nim's own reference type `ref` that is safe, instead of unsafe `ptr` which is 
usually used for low-level code and C FFI.

Anyway, your example can be fixed as follows:
    
    
    type
      thing = object
        text: string
    
    proc show(obj: ptr thing): ptr thing =
      return obj
    
    proc change(obj: ptr thing) =
      obj.text = "Goodbye World!"
    
    var x = thing()
    x.text = "Hello World!"
    
    echo show(addr x).text
    
    change(addr x)
    echo x.text
    
    
    Run

Reply via email to