[Oberon] Unneeded restrictions on local procedures

August Karlstrom fusionfile at gmail.com
Thu Dec 21 18:41:55 CET 2023


On 2023-12-20 22:27, Chris Burrows wrote:> Do you think that 
local procedures are necessary? If so, why are they
> necessary?

They are (almost) necessary for mutual recursion. There is an 
alternative in which you utilize a procedure variable to compensate for 
the absence of forward declarations in the language but it's neither as 
elegant nor as performant.

It's also natural to declare a recursive procedure which needs an 
initial value as a local procedure, or actually any procedure which is 
tightly coupled with another procedure.

	PROCEDURE P(n: INTEGER);
	   PROCEDURE Q(n, a: INTEGER);
	   ...
	      Q(n, a + 1)
	   ...
	   END Q;
	BEGIN
		Q(n, 0)
	END P

Also, preventing procedures from being declared as local objects would 
make the language less regular.


August


More information about the Oberon mailing list