by DonaldFisk · 9y ago · 0 comments
A range is a signed integer value which ranges from a
First to a last Last. It is defined as
range First .. Last
When a value is assigned to an object with such a range
constraint, the value is checked for validity and
Constraint_Error exception is raised when the value is
not within First to Last.It's interesting to me how Ada takes the approach of blending types and run time contracts. In most languages it would be two different things - a function that takes int, then a contract or assert that handles the value.
; Constant 30 conflicts with its asserted type (INTEGER 50 100).
But in many other cases it'll generate a runtime check instead, because the static type checking is basically best-effort.