One thing I often hear from newbies reading nim manual is "nim has got so many arrays! array, openarray, seq! why??". I think we could relax the openarray concept by using array without giving it's length.
proc foo(a: array[int]) # same as openarray[int]
proc bar(a: array[arrayLen, int])# same as openarray[int], but adds arrayLen symbol, that is an alias to a.len
proc modification(a: var array[int]) =
a = [1, 2, 3] # Error. Length of a is not known at compile time.
I think such syntax would still be consistent with the rest of arrays and less frightening to newcomers. Destroy! =) arrayOrSeq is awful. What if I add a new array like type (like an alloca'ed variable length array or a non-resizable seq) that I want to use as an argument? I'd like to say the arguments are array like, but open to extension. openArray is fine.
This issue could maybe be helped by more documentation, perhaps best written by those who have just learned the concept openArray since they remember things that tripped them up.
The name arrayOrSeq is awkward. I don't see any other good alternatives, I dunno List? There should be a convention for types which accept multiple types, perhaps a convention for naming concepts?
I think that this is simply something everyone has to learn about Nim. More trouble renaming it than it's worth.
This issue could maybe be helped by more documentation, perhaps best written by those who have just learned the concept openArray since they remember things that tripped them up.
I have to agree, just fix the docs to what you think they should say.