[Oberon] Modula2 vs Oberon IMPORT
Douglas G. Danforth
danforth at greenwoodfarm.com
Sat Jan 8 07:48:15 CET 2011
> One reason for wanting to use the selective FROM .. IMPORT in Modula-2 is so
> that you can call WriteString and WriteLn in your program without having to
> prefix every call with the module name STextIO.
> To do something similar in Oberon you could use procedure variables to
> declare the names you wanted to use e.g.
> WriteString: PROCEDURE(s: ARRAY OF CHAR);
> WriteLn: PROCEDURE ();
> and then in the module initialisation code you would assign the aliases:
> WriteString := STextIO.WriteString;
> WriteLn := STextIO.WriteLn;
> Chris Burrows
The MAINSAIL language does not require imported procedures to be
prefixed with the module name.
I have found Oberon to be far superior. It makes immediately obvious
what function is being referenced.
If X is present in two module both imported then referencing X is
ambibuous without the module prefix.
More information about the Oberon