Post by nojbHello,
Am I understanding correctly the Oberon-07 report when it says that it
doesn't
allow non-local variables in the body of nested procedures? (page 11,
line -2).
Thanks!
N
In an Oberon-07 procedure you can only access global variables or *strictly
local* variables. For example:
MODULE M;
VAR
v, w: INTEGER;
PROCEDURE P;
VAR v: INTEGER;
PROCEDURE NestP1;
BEGIN
v := 999 (* error: non-local is not accessible *)
END NestP1;
PROCEDURE NestP2;
VAR v: INTEGER;
BEGIN
v := 999 (* the local v is modified *)
END NestP2;
PROCEDURE NestP3;
BEGIN
w := 999 (* the global w is modified *)
END NestP3;
END P;
END M.
This helps to prevent some maintenance / obscure runtime problems. For
example, if the local v is introduced in P sometime after the original
program was written, the fact that it now hides the global v from NestP1 is
made obvious to the programmer.
Regards,
Chris Burrows
Astrobe: ARM Oberon-07 Development System
http://www.astrobe.com