[Oberon] SystemV- Heap + Module Space

Richard Hable informujo at aon.at
Fri Jan 4 22:54:24 CET 2019


On 03.01.19 23:49, Skulski, Wojciech wrote:
> Tomas:
>> MODULE_LOAD_FAILURE
>> This looks like `C' #define constant!
> 
> Intentionally. Sometimes I am under an impression that the C community has worked out some reasonable solutions. Do not say that in this mailing list.

Preprocessor definitions of constants are certainly no reasonable
solution! See, you shouldn't have said it! :)

I once had to maintain a large C program with lots of define statements
like

#define XY_MASK 0x123

arbitrarily distributed among various header files. Within the C source
files there would be some bit operations using these “constants”. It was
hell finding out what these operations would actually do at runtime. I
had to grep through a large number of source files—which sometimes even
lead to different definitions with the same name.

And, of course, these definitions also did not add any additional
flexibility, because they were used to process some binary file formats
which could not be changed without breaking compatibility.

Now, in Oberon we have real constant definitions. Nevertheless, one has
to navigate to the definition section to find out what will actually
happen at runtime. In case of imported constants this requires first
checking the import section to find the (possibly renamed) name of the
referenced module and then analyzing the definition or source file of
the imported module.

> I thought I read this kind of advice somewhere in Oberon textbooks. And then I looked at the Oberon System code. Oh, my.

But another priniciple of Oberon is to make it as simple as possible.
Adding an additional indirection makes it less simple…

IMO, defining a constant usually only makes sense for values which are
expected to have to be changed in the future, and if there are several
references to it.

Richard



More information about the Oberon mailing list