← Back to context

Comment by int_19h

2 years ago

Take a look at Ada sometime, it really takes that to eleven.

   type Digit is range 0 .. 9;

   type Unsigned_Byte is mod 2 ** 8;

   type Binary_Floating_Point is digits 15 range -1.0 .. 1.0;

   type Binary_Fixed_Point is delta 2.0 ** (-32) * Pi range (-Pi / 2.0) .. (Pi / 2.0); 

   type Decimal_Fixed_Point is delta 0.01 digits 5;

Conspicuously missing are Ada's arrays, which I feel properly take Pascal's to 11 due to the fact that describing their index bounds need not also prescribe that arrays statically allocate that much storage, as in `type Unsigned_Byte_Array is array (Positive range <>) of Unsigned_Byte`, where `subtype Positive is Integer range 1 .. Integer'Last`. Substitute `Positive` with `Natural` where you like.