int difference(uint a, uint b) { if (a >= b) { return cast(int) a-b; } else { return -(cast(int) b-a); } }
Wouldn't this be just pushing a design error one step further?uint has no mathematical basis whatsoever, it is there because we "can" have it. I have another solution, remove "uint-uint" from the language and provide explicit functions.