Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
The differences between integer & long hexadecimal literals in Oberon dialects #56
Historically, the LONGINT type in Oberon/Oberon-2 has size 32 bits. And increasing the bit depth of LONGINT type will break compatibility with existing source code. To avoid this problem, some Oberon-implementations use a non-standard type HUGEINT, although it is not present in the description of the Oberon/Oberon-2 language. Therefore, we can consider the type HUGEINT only as a language extension. Accordingly, we should consider the declaration of constants of this type as a language extension too.
With this in mind, and with the need to maintain existing code, we have introduced a new (non-standard) suffix 'L' to declare long hexadecimal literals of (non-standard) type HUGEINT.
As you know, in Oberon/Oberon-2 the real numbers of single precision are written with the suffix "E" (2.44E15), and of double precision -- with 'D' (2.44D15). In Component Pascal, there is no longer the suffix 'D', since there are no single-precision numbers -- all calculations are performed in double. But still, by analogy with this solution in Oberon/Oberon-2, to use the suffix 'L' for long hexadecimal literals seems to be a reasonable solution, only expanding the range of numbers, but not breaking the old code with 32-bit literals.
Ofront+ implements the following ways to define the hexadecimal literals:
Note that Oberon/Oberon-2 and Component Pascal have the ability to specify a number sign in the literal implicitly, whereas Oberon-3 and Oberon-07 don't allow it. We decided that it would be wrong to allow implicit sign assignment and any manipulations with a number at the bit level. "Integers are not bits" (Niklaus Wirth)