[Oberon] Module finalization in PO2013

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Wed Dec 30 09:34:43 CET 2020


   
   > This *could* be solved by a considerably more complex piece of code in Modules.SetClose.


Wojtek,

Following our earlier exchange:

Actually, a brute force method would be to simply move the call to Oberon.Loop down
to Modules (as on Ceres Oberon) and set curmod := NIL *after* loading module Oberon.


  MODULE Modules;
    ...
    VAR loop: Command;
    …
  BEGIN Init; Load("Oberon", M); curmod := NIL; (*so that SetClose would also work in module Oberon*)
    IF res = noerr THEN loop := ThisCommand(M, "Loop"); loop    (*<— Oberon.Loop now called HERE*)
    ELSE LED(res); REPEAT UNTIL FALSE  (*if load fails, e.g. if body of Oberon calls SetClose(externalcmd)*)
    END
  END Modules.


  MODULE Oberon;
    …
  BEGIN
    ...
    Modules.Load("System", Mod); Mod := NIL    (*<— Loop is no longer called HERE*)
   END Oberon.


That would solve it too. But as stated earlier: Not worth the trouble, since module Oberon is never
unloaded anyway => the solution is good the way it is.

-ap




More information about the Oberon mailing list