I looked into converters, which I didn't know about. I thought the following 
might work: make all the type distinct, but automatic conversion to uint32 to 
remove the 'distinction' between sub-type and base type.
    
    
    type
      I1 = distinct uint32
      I2 = distinct uint32
    
    
    converter toU32 (value: I1): uint32 = result = value.uint32
    converter toI32 (value: I1): int32 = result = value.int32
    converter toU32 (value: I2): uint32 = result = value.uint32
    converter toI32 (value: I2): int32 = result = value.int32
    
    var
      v: uint32 = 1
      v1: I1 = 1.I1
      v2: I2 = 1.I2
    
    if (v1 == v):
      echo "1: true"
    
    if (v2 == v):
      echo "2: true"
    
    if (v1 == v2):
      echo "3: true"
    
    
    Run

Returns 3 trues. Still no cigar... 

Reply via email to