Hello all,

(One week experience of learning Nim)

I would like to take advantages of the static typing that would look a bit like 
distinct types, but not exactly. I would like the sub-types to be distinct, but 
each sub-type to be fully equivalent to the base type. For example:

var v:uint32 = 1

type Type1 = uint32 var v1: Type1 = 1

type Type1 = uint32 var v2: Type2 = 1

(v1 == v2) # Currently false. That's good (v == v1) # Currently false. I want 
true.

Why do I want this? It would enable to use uint32 for different purposes. 
Distinct types do that well. However, one of my use of the sub-types is, 
amongst others, as index of arrays. I want to avoid casting/coercing.

Is that achievable?

Reply via email to