[Oberon] Modula2 vs Oberon IMPORT

Jan Verhoeven jan at verhoeven272.nl
Sat Jan 8 17:47:15 CET 2011

Hi Duke,

Still snowed in?

> FROM STextIO IMPORT WriteString, WriteLn;

That's one method. Unqualified imports. Works fine for procedures that 
have unique names. But as soon as you start with function overloading 
(not a Wirthian name) qualification becomes a premium.
I always use qualified imports. It's more clear where to look for 
details about the procedure involved. 

> Conversely, in Oberon, the whole Module has to be IMPORTed in order
> to get to use the equivalent procedures.

Oberon is Modula-2 plus a lot of experience. So they abandoned the 
unqualified imports in favor of clarity of programming.

> It would seem to me that Oberon "programs" would be that much more
> "bloated" with unnecessary code. 

Wrong. You seem to believe that efficiency is proportional to the 
inverse of the filesize. But it's the other way round. FQI (Fully 
Qualified Imports) is 100% clarity at the expense of slightly more 
text. You DO need to fill those Terabyte disks, won't you?

FQI is a coding standard. You just FQI everything, even the imports with 
unique names. So the reader of your sources (which may even be you, 
yourself, in a few years from now) immediately sees which procedure 
from which libaray is usedf where and where to look for details about 
the ins and outs of that procedure.

But, Neither Oberon nor Modula-2 force you to write efficient and clear 
code. So you CAN work around FQI. In a local module, for example, you 
can do the import you like. But this kind of 'efficiency' is more 
appropriate in a curly braces language.

> Am I correct in this conclusion? 

Of course not. You're from North America, the continent that is based on 
efficiency and economy. Wirth is from Switzerland, the country that is 
famous for its chocolate and cuckoo clocks (according to Harry Lime 
in 'The third man'), not for its efficiency or economy. :o)

> Is there a way to selectively IMPORT procedures in Oberon? 

Yes but it will not add clarity to your sources. Unless you use a silly 
kind of importing:

PROCEDURE ReadString (string : ARRAY OF CHAR);

IMPORT In.ReadString;

   In.ReadString (string)
END ReadString;

I'm not sure if the IMPORT in this example will be accepted by all 

> It doesn't appear to me to be possible.

It may be due to the height of the snow in your place.... Here it's all 
molten away again. At last! Today I took the 1150GS for a walk again.

Happy new year Duke. May you gain lots of coding experiences in the 11.

Met vriendelijke groeten,

Jan Verhoeven

More information about the Oberon mailing list