Module finalization - language construct or system call
I would like to solicit input on whether to realize “module finalization” via a CLOSE language construct or via a system call such as Modules.Close. See the test module M below. Both are currently available in Extended Oberon, both are trivial to implement (only a few lines each), but the question is what one *should* offer. Some arguments in favour or against these 2 options include: 1) CLOSE as a language construct: - A entire language construct for a (probably) rarely used feature - Creates another dialect of Oberon-07, limiting portability of programs + clean solution + one does not need to import module Modules + Ease of porting for Component Pascal modules 2) Modules.Close as a system call: + no need for a separate language construct + sufficient for the (rare) cases where it is used - need to add Modules.Close in all systems if one wants portability - one has to import module Modules ———————————————————————— 1) CLOSE as a language construct: MODULE M; IMPORT Texts, Oberon; VAR W: Texts.Writer; PROCEDURE Start*; BEGIN END Start; (*load module*) BEGIN (*module initialization sequence*) Texts.OpenWriter(W) CLOSE (*module finalization sequence*) Texts.WriteString(W, "Finalizing module M…"); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END M. ORP.Compile M.Mod/s ~ # compile module M M.Start ~ # load module M System.Free M ~ # unload module M (prints "Finalizing module M…”) ———————————————————————— 2) Modules.Close as a system call: MODULE M; IMPORT Modules, Texts, Oberon; VAR W: Texts.Writer; PROCEDURE Close; BEGIN Texts.WriteString(W, "Finalizing module M…"); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END Close; PROCEDURE Start*; BEGIN END Start; (*load module*) BEGIN Texts.OpenWriter(W). Modules.Close(Close) END M. ORP.Compile M.Mod/s ~ # compile module M M.Start ~ # load module M System.Free M ~ # unload module M (prints "Finalizing module M…")
Perhaps I might add a third question: Who of you needs this feature in a productive environment knowing that batch command execution exists where a sequence of calls to closing functions can be automated? Jörg Am 04.01.21, 15:50 schrieb "Oberon im Auftrag von Andreas Pirklbauer" <oberon-bounces@lists.inf.ethz.ch im Auftrag von andreas_pirklbauer@yahoo.com>: I would like to solicit input on whether to realize “module finalization” via a CLOSE language construct or via a system call such as Modules.Close. See the test module M below. Both are currently available in Extended Oberon, both are trivial to implement (only a few lines each), but the question is what one *should* offer. Some arguments in favour or against these 2 options include: 1) CLOSE as a language construct: - A entire language construct for a (probably) rarely used feature - Creates another dialect of Oberon-07, limiting portability of programs + clean solution + one does not need to import module Modules + Ease of porting for Component Pascal modules 2) Modules.Close as a system call: + no need for a separate language construct + sufficient for the (rare) cases where it is used - need to add Modules.Close in all systems if one wants portability - one has to import module Modules ———————————————————————— 1) CLOSE as a language construct: MODULE M; IMPORT Texts, Oberon; VAR W: Texts.Writer; PROCEDURE Start*; BEGIN END Start; (*load module*) BEGIN (*module initialization sequence*) Texts.OpenWriter(W) CLOSE (*module finalization sequence*) Texts.WriteString(W, "Finalizing module M…"); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END M. ORP.Compile M.Mod/s ~ # compile module M M.Start ~ # load module M System.Free M ~ # unload module M (prints "Finalizing module M…”) ———————————————————————— 2) Modules.Close as a system call: MODULE M; IMPORT Modules, Texts, Oberon; VAR W: Texts.Writer; PROCEDURE Close; BEGIN Texts.WriteString(W, "Finalizing module M…"); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END Close; PROCEDURE Start*; BEGIN END Start; (*load module*) BEGIN Texts.OpenWriter(W). Modules.Close(Close) END M. ORP.Compile M.Mod/s ~ # compile module M M.Start ~ # load module M System.Free M ~ # unload module M (prints "Finalizing module M…") -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Hi Andreas, On Mo, 2021-01-04 at 15:50 +0100, Andreas Pirklbauer wrote:
I would like to solicit input on whether to realize “module finalization” via a CLOSE language construct or via a system call such as Modules.Close. See the test module M below. Both are currently available in Extended Oberon, both are trivial to implement (only a few lines each), but the question is what one *should* offer.
I would opt for a proper language construct, as this is a symmetrical complement to the initialization of a module. I would however prefer a different keyword for it, e.g. "FINAL", because "CLOSE" has a tight connotation to files, at least for me. Hellwig
Generally, I agree with Hellwig that I like FINAL, Finalize... better than Close. https://en.wikipedia.org/wiki/Finalizer If we are just in the mood to invent new languages, why not call it FREE (because that code will be triggered by System.Free) or UNLOAD as Modules triggers the code when it unloads the module. Or DESTROY as other languages make a distinction between finalizers (called by GC) and destructors (deterministic)... We can do whatever we want, but it won't be Oberon-07 anymore... br Jörg Am 04.01.21, 16:29 schrieb "Oberon im Auftrag von Hellwig Geisse" <oberon-bounces@lists.inf.ethz.ch im Auftrag von hellwig.geisse@mni.thm.de>: Hi Andreas, On Mo, 2021-01-04 at 15:50 +0100, Andreas Pirklbauer wrote: > I would like to solicit input on whether to realize “module finalization” > via a CLOSE language construct or via a system call such as > Modules.Close. See the test module M below. Both are currently > available in Extended Oberon, both are trivial to implement (only > a few lines each), but the question is what one *should* offer. > I would opt for a proper language construct, as this is a symmetrical complement to the initialization of a module. I would however prefer a different keyword for it, e.g. "FINAL", because "CLOSE" has a tight connotation to files, at least for me. Hellwig -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Hi Jörg, On Mo, 2021-01-04 at 17:04 +0100, Joerg wrote:
We can do whatever we want, but it won't be Oberon-07 anymore...
yes, I agree. And we should very carefully think over before taking such a step. I must confess that I've lost track a little bit of the many experimental features introduced by Andreas. I understand that Extended Oberon is a language/implementation lab where things can be tried out, and I appreciate these experiments very much. Especially the more uniform handling of variable access by eliminating the need for a static base register is great, as well as safe module unloading is. But changing the language proper is indeed another beast... The broader question of course is: what are we trying to achieve? Hellwig
Hellwig wrote:
The broader question of course is: what are we trying to achieve?
It depends on who are "we". There seem to many "we" in this group. 1) Some "we" are perfecting the language itself, even if the improvements are breaking the legacy code. 2) Some "we" would like to develop practical applications with a reasonable time and effort. 3) Some "we" believe in "do not fix it if it ain't broken". Some others think this statement has no value. We have not agreed on a basic question "should Oberon be used for practical developments, or should it be perfected regardless of whether it is used". There seem to be diverging opinions on this subject. W.
participants (4)
-
Andreas Pirklbauer -
Hellwig Geisse -
Joerg -
Skulski, Wojciech