The following code snippet results in this error: `Error: '=copy' is not available for type <Obje>; requires a copy because it's not the last read of 'r[]'; routine: main`.
I'm clearly trying to copy `r` by dereferencing it, so I was expecting the `'=copy' is not available` error but the compiler is saying the actual problem is that's not the last read of `r`. What's going on here? Is the compiler inserting some reads for `r`? Or is the `=copy` hook error hardcoded that way? type Obje = object x, y, z, w: float64 Robje = ref Obje proc `=copy`(x: var Obje, y: Obje) {.error.} proc mutate(ob: var Obje) = ob.x += 1 ob.y += 2 proc main() = var e = Obje(x: 1, y: 2) var r = Robje(x: 3, y: 4) echo r.repr mutate(r[]) echo r.repr e = r[] when isMainModule: main() Run