Should hidden re-imports be able to coexist with identifiers
The following reports a “mult def” error in PO 2013 when compiling M2 MODULE M0; TYPE T0* = RECORD i: INTEGER END ; END M0. MODULE M1; IMPORT M0; TYPE T1* = RECORD (M0.T0) j: INTEGER END ; END M1. MODULE M2; IMPORT M1; (*re-imports M0.T0*) VAR M0: INTEGER; (* <--- "mult def” error message*) END M2. In PO2013 this error is reported because the symbol table headed by topScope *also* contains the re-imported module M0 (which is a bit unfortunate) -- but ORB.NewObj does not check that fact. I my mind, M2 should compile with no error message. i.e. hidden re-imports should be able to coexist with regular identifiers (since one cannot refer to re-imported objects by name anyway). Comments?
I agree. The above example works in oberonc <https://github.com/lboasso/oberonc> (once you make use of the import M1 and global variable M0 since unused identifiers will be an error in oberonc). At this point I am more and more convinced that the algorithm from* Griesemer R. On the Linearization of Graphs and Writing Symbol File* is the best approach while still being relatively simple to implement. This corner case and many more are handled and it removes the import order limitation of Wirth's compiler. On Thu, May 13, 2021 at 9:33 AM Andreas Pirklbauer < andreas_pirklbauer@yahoo.com> wrote:
The following reports a “mult def” error in PO 2013 when compiling M2
MODULE M0; TYPE T0* = RECORD i: INTEGER END ; END M0.
MODULE M1; IMPORT M0; TYPE T1* = RECORD (M0.T0) j: INTEGER END ; END M1.
MODULE M2; IMPORT M1; (*re-imports M0.T0*) VAR M0: INTEGER; (* <--- "mult def” error message*) END M2.
In PO2013 this error is reported because the symbol table headed by topScope *also* contains the re-imported module M0 (which is a bit unfortunate) -- but ORB.NewObj does not check that fact.
I my mind, M2 should compile with no error message. i.e. hidden re-imports should be able to coexist with regular identifiers (since one cannot refer to re-imported objects by name anyway).
Comments?
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
participants (2)
-
Andreas Pirklbauer -
Luca Boasso