cfbsoftware wrote: (...) Astrobe v4 Oberon currently does allow access to "intermediate level" objects. It does not allow access to "intermediate level" variables. I believe that they are specifically excluded in Revision 22.9.2011 of the report.
What you can be sure of is that Astrobe v4 Oberon only allows access to variables that are either "strictly global" or "strictly local".
We might reconsider that behavior if a future version of the report removes the additional qualification "of variables and" from the phrase "(with the exception of variables and of those objects that have the same name as an object declared locally)".
I'm puzzled by the term "intermediate level" in this context. Could anyone give code examples of an "intermediate level" object and of an "intermediate level" variable?
To find out what Wirth could have meant by this term I looked through some code that he wrote and published relatively recently (2007 and later). I noticed that even Wirth cannot avoid entirely the use of global variables that are changed locally within procedures. E.g. in his description of An Oberon Compiler for the ARM Processor
on p. 33 he shows "a rudimentary handler for the ARM’s IRQ interrupt. It merely increments a global counter":
Code: Select all
CONST IntVec = 18H; StkOrg = 800H;
VAR count: INTEGER;
PROCEDURE Handle ;
BEGIN count := 0;
SYSTEM.PUT(18H, (SYSTEM.ADR(Handle) - IntVec - 8) DIV 4 + 0EA000000H);
SYSTEM.LDPSR(0, 0D2H); SYSTEM.SP := StkOrg; (*set stack pointer*)
SYSTEM.LDPSR(0, 53H); (*enable IRQ interrupt*)
Other examples of the extensive use by Wirth himself of global variables that are accessed from within procedures can be found in the Oberon modules for the Oberon-0 compiler described in the 2011 version of his book on Compiler Construction (OSP.Mod, OSG.Mod, OSS.Mod), which can be found here
. To be fair this code was written before the times of Oberon-07, but to presume that Wirth has always used a coding style that avoided the use of global variables is not entirely accurate.
IMHO it is good programming style to try and avoid the use of global variables, but to preclude their use entirely is probably too restrictive.
I wonder whether the code for the Astrobe Oberon compiler avoids the use of global variables or not?