> I don't talk about "overhead". There is a clear subset relation, Natural <= 
> int so you know the conversion from Natural to int cannot fail.

Weren't we talking about subtracting with going down under zero? This can fail. 
I just want to understand how int subrange is a better solution than using 
checked uints (i.e. for indexing).

> Well the example is simply about iterating over a subset if such a subset 
> exists

Well, you see, you can't infer this _if_ clause you have from reading the code. 
This is, as it happens, just what it does, but it's not clear if this had been 
the intent of the one who wrote it. I have a hunch a panic on `for a in 0..-4` 
would be not a bad thing to do, because this expression doesn't make any sense, 
follows it's a bug. If it was some `0..<a.len().saturated_sub(4)` then both the 
intent and the behaviour would be absolutely unambiguously clear. On the other 
hand, this is just forcing proper code documenting with runtime costs, which is 
also not good. :P

Reply via email to