Intermediate scopes in Oberon-07
Hi all
In low layer modules, I like to declare local TYPEs in a procedure to redefine the TYPE of a parameter. Just as an example parameter is INTEGER, I would like to work with C4 = ARRAY 4 OF CHAR. Obviously, I could work on the parameter with pure SYSTEM.GETs but for the sake of the example let’s stick to C4 for a minute.
Now, as Oberon has no macros, I declare in my PROCEDURE with the local C4 another nested procedure as kind of writing shortcut in my procedure’s code.
Et voila, I‘m in the situation where the nested procedure should have access to the intermediately declared C4.
Would you accept this as a valid example for intermediate TYPEs?
Jörg
I assume you mean something like this: MODULE M; PROCEDURE P(x: INTEGER); TYPE C4 = ARRAY 4 OF CHAR; PROCEDURE Q(y: INTEGER); VAR c4: C4; (*intermediate type C4 used here*) BEGIN END Q; END P; END M. The current official Oberon compiler, as published in projectoberon.com <http://projectoberon.com/>, would accept it, my slightly modified compiler from the last post wouldn’t and would require C4 to be declared globally. Andreas
participants (1)
-
Andreas Pirklbauer