3 ms·
Ada doesn't. It also allows creating semantic versions of the same type which the type checked will catch if you mess them up. You can also add ranges to prim
by pyjarrett 5y ago
Ada doesn't. It also allows creating semantic versions of the same type which the type checked will catch if you mess them up. You can also add ranges to primitive types as well. If you want the wrapping behavior of an unsigned type, you can use "modular types" which are expressly designed for that behavior.
-- You can't assign some value of type Apples to Oranges
-- without a conversion
type Apples is new Integer;
type Oranges is new Integer;
-- Only allow whole number ranges of a percentage.
type Percentage is range 0 .. 100;