[Oberon] BYTE in Oberon-07
paulreed at paddedcell.com
Mon Apr 13 15:55:56 CEST 2020
Hi August, Hans,
> In the language report BYTE is defined as "the integers between 0 and
> 255" and "The type BYTE is compatible with the type INTEGER, and
> vice-versa." This implies that INTEGER is compatible with BYTE *only*
> if the value is between 0 and 255.
When working with Prof. Wirth on the FPGA Oberon project I had already
been asking for some time for him to consider adding BYTE to Oberon-07.
It's really not right that CHAR is abused for such purposes (and creates
difficulties when CHAR is not 8 bit, for example I had experimented with
Unicode using the original ARM Oberon-07 compiler).
He smiled when he explained to me how he had added BYTE to the compiler
with only one line of code (after I had suitably recovered from the
revelation). He simply reminded me that there is a difference between
the type of something and its range. This is a distinction which is not
often made these days, now that machines are a bit nicer than the ones
he grew up with. :)
Obviously the range is not always checked in our implementation, just
like arithmetic overflow tends not to be checked in most of his
compilers; but this is rarely a problem in practice.
Cheers, (and thank you very much for the enjoyable Easter-egg hunt!) :)
More information about the Oberon