[Oberon] Hennessy.Mod 64kB limit
joerg.straube at iaeth.ch
Tue Feb 18 16:00:32 CET 2020
You are right CONST are a good thing.
Personally, I change from literals to CONST if two conditions are met:
a) I use the value more than once
b) I intend to change it
As said, this is my personal agreement. In our current case both conditions are not met 😊
Eg if you look at my Display.color.Mod I heavily use CONSTs in contrast to the current Display.Mod that is full of literals that might change if you have another resolution.
From: Oberon <oberon-bounces at lists.inf.ethz.ch> On Behalf Of Skulski, Wojciech
Sent: Tuesday, February 18, 2020 3:46 PM
To: ETH Oberon and related systems <oberon at lists.inf.ethz.ch>
Subject: Re: [Oberon] Hennessy.Mod 64kB limit
>The 64KB limit is known, but I'm surprised as well that this limit is not checked.
> Add to ORG.CheckRegs the following IF:
> IF varsize + strx > 0FFFFH THEN ORS.Mark("too many globals") END;
This amounts to a sin. Hardcoded literals are against Niklaus Wirth school of programming. I have picked relevant citations from The Gospel. Why is the community disregarding The Gospel?
This should be:
CONST GLOBLIMIT = 0FFFFH; (*or GlobLimit, MaxVar, or any good and descriptive name*)
IF varsize + strx > GLOBLIMIT THEN ORS.Mark("too many globals") END;
Shall we ever learn from Niklaus Wirth?
More information about the Oberon