Re: Are array types that differ only in index boundaries different?

2017-09-26 Thread Tiberium
LeuGim: a side note: it's not an implicit conversion, with "var x: int8" Nim treats your "3" literal as "int8" type

Re: Are array types that differ only in index boundaries different?

2017-09-26 Thread LeuGim
Regarding assignment, it doesn't have to depend on types being indistinguishable. E.g.: proc p(x: int) = echo "int" proc p(x: int8) = echo "int8" var x: int8 x=3 # implicit conversion p x # int8 p 3 # int overloading works here, while allowing literal's

Re: Are array types that differ only in index boundaries different?

2017-09-26 Thread LeuGim
You can try to search forum for if there were previous discussions... Just > the situation when you can declare something that you cannot later call seems to be not intended.

Re: Are array types that differ only in index boundaries different?

2017-09-26 Thread olwi
I can definitely report this on Github, but before doing this I'd like to better understand this inconsistency. It seems that for array initialization to work as expected, array types that differ only in index boundaries should be treated as equal. Otherwise this: var b: array[-1

Re: Are array types that differ only in index boundaries different?

2017-09-26 Thread LeuGim
Report it as a bug on Github, if it's not there already, it's an old issue.

Are array types that differ only in index boundaries different?

2017-09-26 Thread olwi
Two arrays of the same size and element type but with different index boundaries seem to be distinct types for the purpose of (polymorphic) proc definitions, so this compiles: proc p(a: array[10, int]) = discard proc p(a: array[-1 .. 8, int]) = discard but they seem to