[Oberon] Unneeded restrictions on local procedures

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Thu Dec 21 05:15:24 CET 2023


> Exactly! However, if the language allows you to assign that local procedure
> to a global procedure variable the reader can no longer depend on that
> being true.
>
> Regards,
> Chris Burrows
> CFB Software

Except if one allows assigning a local procedure to a *local* procedure
variable, or passing them as a parameter to a *local* procedure.

That’s the one restriction that could (perhaps?) be lifted. 

MODULE M;
  TYPE Proc = PROCEDURE(i: INTEGER);
  PROCEDURE P;
    VAR p: Proc;
    PROCEDURE Q(i: INTEGER); END Q;
    PROCEDURE R(p: Proc); END R;
  BEGIN
    p := Q; (*should this be allowed?*)
    R(Q);   (*should this be allowed?*)
  END P;
END M.



More information about the Oberon mailing list