[Oberon] Why macros were not implemented in oberon language?
oberon at moravcik.info
oberon at moravcik.info
Sat Jul 5 13:50:44 CEST 2014
you are right that the term "procedure inlining" describes my problem more precisely than the word "macros" (although I feel there is some overlapping in the meaning/usage/definition of those two terms).
Your excerpt from Wirths chapter 5.1 tells me that Wirth wishes conservative approach in adopting new changes into language definitions
(" Promoting the ease by which a language can be modified and extended may therefore be rather counterproductive.").
Also p. Wirth is right when he writes "Ultimately, the basic idea behind every language is that it should serve as a means for communication."
That probably means that source code should be in its most possible human readable/understandable form to be able to communicate it to others. I agree fully with this.
But I hope he did not also mean by it that it should occur at the expense of speed/space optimisation.
Wikipedia describes procedure (function) inlining as:
"In computing, inline expansion, or inlining, is a manual or compiler optimization that replaces a function call site with the body of the callee. This optimization typically improves time and space usage at runtime, at the cost of increasing the final size of the program (i.e. the binary file size), but in some cases may decrease runtime performance or decrease the final size of the program.
Inlining is done automatically by many compilers, while in other cases it can be manually specified via compiler directives, typically using the inline keyword; typically this only hints that inlining is desired, rather than requiring inlining. Compilers use a variety of mechanisms to decide which function calls should be inlined; these can include manual hints from programmers for specific functions, together with overall control via command-line options."
>From all of the ETH oberon documents I have read so far I cannot remember there was a mention of some procedure inlining in oberon compiler.
Therefore I think there is neither manual nor automatic procedure inlining built in oberon compiler.
And as there are also no macros in oberon it means that when a programmer writes a time critical application he has no other choices left than to write repeating commands every time he needs to use them.
And that makes at the end his source code less human readable/understandable.
I do not know about the whole commercial sector but I am 100% sure that certain commercial applications can be VERY, VERY time critical!
For example every application for autonomous vehicles is a time critical algorithm.
If I would be at some company writing software for autonomous cars I would probably for this reason not think of oberon as language of first choice.
And that's a pity because otherwise oberon is very good language.
More information about the Oberon