[Oberon] IMPORT Modules: why does order matter?
Till Oliver Knoll
till.oliver.knoll at gmail.com
Thu Feb 28 22:13:30 CET 2019
It seems that with the Project Oberon 2013 compiler the order of imported modules seems to matter now (at least in „Oberon Core“, as available in the Mac App Store). That was definitively not the case with OberonV4.
E.g. when I have:
IMPORT Oberon, ..., Display;
I get an „invalid import order“ (or similar) compile error, which I have to „fix“ with:
IMPORT Display, ..., Oberon;
(Or the other way around - just for illustration).
I haven‘t yet figured out the „rule“ of the correct ordering, but I suspect it has to do with the Oberon Module hierarchy, or „lower modules first“. So far I just shuffled the imports around, until it compiles.
Is that the expected behaviour of the compiler? If so (out of pure curiosity): what could be the reasoning behind that? Does it simplify the compiler by, say, 3 KByte worth of source code? :)
Or is there really a (compiler) technical reason which significantly improves „dependency parsing“?
Or does the compiler simply want me to know Oberon‘s module hierarchy by heart?
(Mind you, I am not talking about the order of compilation of my modules; that I know. I am really referring to the order of a single import statement).
More information about the Oberon