Earlier quoted context omitted.
It's nice to read a positive comment like yours occasionally, because the vast majority of the time, I'm just disappointed in how bad our programming tools (including languages) are. It's become a meme in my office that I'm the guy constantly bitching about how stupid our languages are. This week I was back on my soap box about the fact that almost zero mainstream (statically typed) programming languages can even let…
> How many times did you write "int" when you actually only wanted a positive number? subtracting one from zero and getting max_uint can be its own brand of fucking horribly awful. having the language itself throw in that circumstance can also be exactly what you don't want.
type Byte is unsigned 2**3;
This will permit any value in the range [0,7] and when you exceed it (in either direction) it will wrap around (the desired action if you choose this type). In contrast: type Byte is range 0..7;
Will give you a runtime error when you exceed the bounds by trying to increase beyond 7 or decrease below 0. Having this choice is nice, you get to decide the semantics for your system.