[Oberon] Module finalization in PO2013

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Wed Dec 30 00:44:28 CET 2020


A simple module finalization mechanism that does NOT require a change in the
Oberon-07 language (i.e. no CLOSE as as Component Pascal) is available at

  https://github.com/andreaspirklbauer/Oberon-module-finalization

Comments are welcome. Test program:

  MODULE Test;
    IMPORT Modules, Texts, Oberon;

    VAR W: Texts.Writer;

    PROCEDURE Finalize;
    BEGIN Texts.WriteString(W, "Finalization of Test");
      Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf)
    END Finalize;

    PROCEDURE Start*;
    BEGIN (*load module*)
    END Start;

  BEGIN Texts.OpenWriter(W); Modules.SetClose(Finalize)
  END Test.

  ORP.Compile Test.Mod/s ~      # compile Test
  Test.Start ~                  # load Test
  System.Free Test ~            # unload Test (prints "Finalization of Test")




More information about the Oberon mailing list