[Oberon] PO2013 - Modules.Load - recursion

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Sat May 30 20:18:48 CEST 2020

    > But recursion during load does not terminate?
    > MODULE M0;
    >  IMPORT M1, Out;
    >  PROCEDURE Load*; END Load;
    > PROCEDURE Echo*; BEGIN Out.String("M0 echo"); Out.Ln END Echo;
    > BEGIN M1.Echo
    > END M0.
    > MODULE M1;
    >   IMPORT M0, Out;
    >   PROCEDURE Echo*; BEGIN Out.String("M1 echo"); Out.Ln END Echo;
    > BEGIN M0.Echo
    > END M1.

Since modules M0 and M1 can only be compiled using a tricky sequence
of editing and compilation steps, isn’t an endless recursion in the loader
a perfectly acceptable solution for such a pathological case?

PS: There are at least two ways to avoid the endless recursion:

1. Catch the cyclic import during compilation. This would
require modifying module ORB. It has been done before,
not that hard. about 25-50 additional lines.

2. An iterative module loader. This too has been done.

Just not in PO 2013.

More information about the Oberon mailing list