[Oberon] Easter eggs in Oberon

August Karlstrom fusionfile at gmail.com
Mon Apr 13 20:49:19 CEST 2020


On 2020-04-13 17:36, Joerg wrote:
> The word „numeric type“ is not clearly defined in the report.
> 
> Eg. is BYTE part of the numeric types?

BYTE is defined as "the integers between 0 and 255" and integers are 
numeric, so the answer must be yes.

> Or is INTEGER part of the numeric type?

It has to be, otherwise you would not able to calculate anything with 
integers.

> If it was you sould be able to write i := i / 3;  (as / is defined on numeric types)...

No, because "The operators +, −, *, and / apply to operands of numeric 
types. Both operands must be of the same type, which is also the type of 
the result." The result of i / 3 is not an integer unless i is a 
multiple of three. Therefor it applies to operands of type REAL.

> The Oberon report leaves some room for interpretation... (especially for corner cases)
> 
> b := -2;  is equivalent to b := 254;

It may give the same result on one implementation but it is still 
undefined; again the Oberon report says that BYTE is "the integers 
between 0 and 255," not "the integers between -128 and 127."


-- August


More information about the Oberon mailing list