On Tuesday, 23 August 2016 at 20:40:06 UTC, Andrei Alexandrescu
wrote:
* When composing, do the limits compose meaningfully?
Just to make sure I understand what you mean by "composing
limits", do you mean this?
alias NonNegativeInt = CheckedInt!(int, Abort, 0, int.max);
alias Ubyte = CheckedInt!(NonNegativeInt, Abort,
NonNegativeInt(0), NonNegativeInt(255));
Ubyte b; //b is guaranteed to be in [0, 255]
And then we should expect this to fail:
alias Byte = CheckedInt!(NonNegativeInt, Abort,
NonNegativeInt(-128), NonNegativeInt(127));