[Oberon] Intermediate scopes in Oberon-07
Andreas Pirklbauer
andreas_pirklbauer at yahoo.com
Sat Feb 10 14:44:04 CET 2018
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20180210/dc32980f/attachment.html>
More information about the Oberon
mailing list