[Oberon] Oberon-2 type bound procedure scope

August Karlstrom fusionfile at gmail.com
Sat Dec 9 21:53:33 CET 2023


On 2023-12-09 20:09, Diego Sardina wrote:
> By definition: "The scope extends textually from the point of the
> declaration to the end of the block (procedure or module)". By saying
> that, "within its declaration" can be considered the same "within its
> scope".
The complete sentence is

"The scope extends textually from the point of the declaration to the 
end of the block (procedure or module) to which the declaration belongs 
and hence to which the object is local."

Let's take this procedure as an example:

	   PROCEDURE P;
	      PROCEDURE Q;
	      ...
	      END Q;
	   BEGIN
	   ...
	   END P

The quoted sentence says that the scope of Q starts at line two and 
extends to the end of the procedure P. To my understanding an identifier 
cannot live in two scopes at the same time, so Q belongs to the local 
scope defined by P and not to the local scope defined by Q. Therefor, 
according to the scope rules alone a local procedure (in this case Q) 
cannot call itself since its identifier lives in an intermediate scope.

/August


More information about the Oberon mailing list