[Oberon] Unneeded restrictions on local procedures
Chris Burrows
cfbsoftware at gmail.com
Wed Dec 20 07:11:20 CET 2023
On Wed, Dec 20, 2023 at 5:50 AM August Karlstrom <fusionfile at gmail.com>
wrote:
> In two recent threads we have discussed scopes and local procedures in
> Oberon-07. One thing that I have been thinking about is that since the
> change was made to prevent access to intermediate scopes the restriction
> that a local procedure cannot be assigned to a procedure variable or
> passed as a procedure parameter no longer makes any sense. The sentence
>
> "P must not be declared local to another procedure, and neither can it
> be a standard procedure."
>
> in section 6.5 should be replaced with
>
> "P cannot be a standard procedure."
>
>
I disagree. Consider this example:
MODULE ProcVars1;
TYPE
ProcType = PROCEDURE();
VAR
p2: PROCEDURE;
PROCEDURE GlobalP;
BEGIN
END GlobalP;
PROCEDURE P1;
PROCEDURE P;
BEGIN
END P;
BEGIN
P(); (* Valid *)
p2 := P; (* Not valid because "P is declared local to another procedure"
i.e. P1 *)
p2 := GlobalP; (* Valid *)
END P1;
END ProcVars1.
Regards,
Chris Burrows
CFB Software
https://www.astrobe.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20231220/eb320a49/attachment.html>
More information about the Oberon
mailing list