[Oberon] Module finalization via a CLOSE language construct

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Sat Jan 2 23:04:00 CET 2021


Module finalization via a language construct CLOSE (as in Component
Pascal) is now available in Extended Oberon, as an experimental feature:


  MODULE M;
    IMPORT Texts, Oberon;
    VAR W: Texts.Writer;
    PROCEDURE Start*; BEGIN (*load module M*) END Start;

  BEGIN
    Texts.OpenWriter(W)
  CLOSE
    Texts.WriteString(W, “Finalize M”); Texts.Append(Oberon.Log, W.buf)
  END M.

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



PS: CLOSE and Modules.Close cannot be mixed and matched.



More information about the Oberon mailing list