Hi!
It seems that there is a problem with openarrays and slices:
proc test(a: openarray[int], b: var openarray[int]) =
b = a[0 .. 4]
The compiler outputs: Error: could not resolve: a[0 .. 4]
If I change a to seq it compiles but the result is incorrect:
proc test(a: seq[int], b: var openarray[int]) =
b = a[0 .. 4]
var a = @[0,1,2,3,4,5,6,7,8,9]
var b = newSeq[int](10)
test(a, b)
echo b
Output: @[5, 5, 0, 1, 2, 3, 4, 0, 0, 0]
If both parameters are seqs it works correctly:
proc test(a: seq[int], b: var seq[int]) =
b = a[0 .. 4]
var a = @[0,1,2,3,4,5,6,7,8,9]
var b = newSeq[int](10)
test(a, b)
echo b
Output: @[0, 1, 2, 3, 4]
I'm using: Nim Compiler Version 0.13.1 (2016-04-14) [MacOSX: amd64]