Yielding loop-clauses
Paul Leyland
paul.leyland@gmail.com
Sun Oct 5 05:31:12 GMT 2025
chris hermansen wrote:
> But the concept of FOR i FROM 1 BY 17 TO max_int DO ... OD never
> terminating and never causing an exception, yep that's an interesting
> consequence of signed integers wrapping around...
> Maybe this is a good point to mention again that I find it kind of odd that
> Algol 68 seems to think all INTs live between - max_int and max_int.
The former is easily fixed. Have the standard prelude define max_int and
min_int be one less than and one more than respectively the two signed
values which cause overflow or underflow. Anything, including conversion
between BITS and INTs, which attempts to create anything with those two
values will generate an exception. Needless to say, the same definition
would apply to LONG INTs etc.
This proposal gives defined behaviour (already noted as being desirable)
and all INTs do indeed live between min_int and max_int inclusive. To me
the Algol 68 conception of an INT is exactly the right one. The days of
16-bit arithmetic, where one may find it helpful to have the maximum
possible range, are long gone.
Paul
More information about the Algol68
mailing list