[Oberon] Easter eggs in Oberon

August Karlstrom fusionfile at gmail.com
Wed Apr 15 18:59:25 CEST 2020


On 2020-04-13 22:37, Joerg wrote:
> Why is there an INC if you have +

Good question. Though it's nice not having to read the same identifier 
twice; compare

	INC(aRatherLongVariableName, 37)

with

	aRatherLongVariableName := aRatherLongVariableName + 37

> Why is there an ASR if there is a DIV
> Why is there an LSL if there is a *

Because shift is faster than division and multiplication, and doesn't 
require compiler optimizations. This is in accordance with Wirth's idea 
of separating the task of compilation so that things which are easy for 
the programmer to do is done by the programmer and things which are easy 
for the compiler to do is done by the compiler.

> Why do you have to change THREE things when going from INTEGER to REAL
>     i := i DIV 5;
>     r := FLT(i) / 5.0
It makes

	* the language simpler
	* the compiler simpler
	* it easier to reason about the result without having to remember 
implicit conversion rules.

The obvious drawback of having to use FLT and FLOOR is that it makes 
expressions harder to read.


-- August


More information about the Oberon mailing list