[Oberon] Why macros were not implemented in oberon language?

oberon at moravcik.info oberon at moravcik.info
Sat Jul 5 12:03:22 CEST 2014

I am using oberon language and I think I will keep using it because compared to C language oberon is higher level language therefore for me (as a human) oberon is a better language to understand.
But it seems to me that even oberon language is not perfect. Sometimes I am asking myself why prof. Wirth did not implement macros in his language? 

There are builtin procedures like INC(n) or DEC(n) in oberon. If you ask yourself why there are such procedures if you can express the same thing by
writing n := n + 1 and n := n - 1 it is obvious to me that those two procedures were implemented because on machine level 
incrementing/decrementing can usually be done more efficiently by choosing different processor instructions and therefore the program runs faster.

But now consider this.
If you have in your program some repeating code like "IF i < 30 THEN n := n + 10 END" and this code repeats many times you can obviously 
write procedure like:

PROCEDURE RepeatingPart;
 IF i < 30 THEN n := n + 10 END
END RepeatingPart;

and call this procedure the same way you are calling a macro.
Your program gets more readable by human but computer has to call every time one more procedure which makes it run little bit more longer.
Therefore omitting macros and replacing them with proper procedures is not perfect program optimisation when program speed is an issue while at the same time letting INC,DEC inside oberon is considered a optimisation effort?

Maybe I am wrong and miss some point here. Someone could explain to me why there are no macros in Oberon?
Or even better someone of you at ETH could ask professor Wirth directly why he chose not to implement macros in his oberon?


More information about the Oberon mailing list