It looks like the runtime and the compile-time copy semantics of sequences is different. Does anybody know if this is intentional or a bug ?
A small example ...
proc fun(a, b: var seq[seq[int]]) =
b[0] = a[0]
proc test() =
var
a = @[@[1]]
b = @[@[2]]
fun(a, b)
a[0][0] = 3
echo " -->> ", b[0][0]
static: test()
test()
Gives as output:
>> nim c -r test.nim
Hint: system [Processing]
Hint: test [Processing]
-->> 3
Hint: [Link]
Hint: ... [SuccessX]
-->> 1