> dest not on stack and src is not nil, so ref is increased?
Hmm, that's a good point. I need to think about this.
> Is it legal to continue to use x?
Yes.
Thanks. But I'm still under the impression that `d.s = "abc"` increases the ref
count of `"abc"`. If I understand correctly `d.s = "abc"` will lead to the
execution of the following function:
proc unsureAsgnRef(dest: PPointer, src: pointer) {.compilerProc.} =
#
The manual is completely wrong here. `GCunref` needs to be paired with `GCref`,
always. And indeed you need the GCref in order to keep the GC from collecting
the string too early.
I noticed the following example in the nim manual to demonstrate how to use an
untraced object:
type
Data = tuple[x, y: int, s: string]
# allocate memory for Data on the heap:
var d = cast[ptr Data](alloc0(sizeof(Data)))
# create a new string on the