> It's known at compile time as int32 int, not int32
> It's known at compile time as int32, not iX, while nim compiler totally > ignores this and assume they are compatible. But they aren't. [...] the more > sane option is not provide a subrange type in the first place. again, not-a-bug. 2.int (and all the others) convert to range[1..5], and a range-check is performed at runtime. There are few implicit conversions in nim (unlike C, C++, D etc), but this one makes sense and is convenient, it avoids having a bunch of boilerplate conversions. type iX = range[1..5] var a: iX = 3 let b = 3 a = b a = 4 a = 2.int doAssert type(a) is iX doAssert type(a) is int doAssert int isnot iX proc fun(a: iX) = discard fun(3) fun(int(3)) Run in any case, this is really a very minor issue; there are other fair criticisms one could make about nim but this ain't one of them.