I'm trying to modify a sequence in-place by modifying the values without copying the data.
This worrks, but I wonder wether I'm doing it in an idiomatic 'Nim' way, rather than trying to use `ptr` too much. I feel the answer should be here, where it is suggested to use `ref`. Not sure how to get that working tho: <https://forum.nim-lang.org/t/6457> tl;dr In the code below, I expect that I should use `ref seq[Vertex]` while `ptr` is meant for interfacing with C and such. Is that correct, and if so, how to modify the snipppet of code? types type Int32x2 = array[2, int32] Vertex* = Int32x2 Polygon* = object of RootObj vertices*: seq[Vertex] fill*: LCDPattern Run code proc loadPolygon(level: Level, obj: LevelObjectEntity): bool = let objOffset: Vertex = [obj.x, obj.y] var polygon: Polygon = obj.getPolygon() var vertices: ptr seq[Vertex] = addr polygon.vertices let lastIndex = vertices[].high if lastIndex < 2: return false # polygons require at least 3 vertices # Offset the polygon by the object's position (localToWorld) for i in 0..lastIndex: vertices[i] = vertices[i] + objOffset [..] Run