[Oberon] Procedure variables and local procedures

chris chris at gcjd.org
Sat Sep 30 11:56:41 CEST 2017

On Sat, 30 Sep 2017 02:33:16 +0200, Jörg wrote:
>> VAR b : BYTE; i : INTEGER;
>>    i := 1000; b := i;
>> Does it trap for overflow?
> The compiler does not generate a trap. It moves the lowest byte of i 
> to b. See first IF in ORG.Store.

Well, that is considered good style? In my opinion this kind of low 
level action should not be in the base language. If it's defined to be 
"least significant byte" that would be a bit better, but this could 
result in some surprise on different hardware.

Leaving this undefined in the language report makes the type BYTE an 
unusable feature for portable programs.

> Would you please explain „dynamic arrays“? Do you miss the low level 
> SYSTEM.NEW(p, n)?

I mean things like:

  p : CharPtr;
  NEW(p, 1234);

There is nothing low level here. That is a widely used feature in ETH 
Oberon (System 3) or whatever you call it today. What is wrong with 
this? Even if I had to write a string librarary for UTF8 I would use 
this feature for the buffers internally and not linked list of fixed 
(compile time determined) sized pieces.

Greeting, chris

More information about the Oberon mailing list