[Oberon] Negative integer literals in Oberon

Joerg joerg.straube at iaeth.ch
Sat May 2 15:31:54 CEST 2020


Read my last mail to Jan.
Firstly, ADR is a low level function. All low level functions are a little bit stetching the strong typing rule Oberon normally has.
So, if ADR reports back the INTEGER -1000, what does this mean? Does negative memory exist?
No. Basically, ADR is defined as returning an INTEGER but in reality it passes back a value (ignoring its type) you can use for SYSTEM.GET/PUT.
These low level functions ignore the sign and treat negative values as positive.
Strictly speaking, those low level functions misuse the INTEGER construct to transport unsigned 32bit values, ignoring the sign bit.

Very puristically speaking Jan is right: You should introduce a new base type eg BIT32 (not to use the word CARDINAL) where low level programmers can transport and manipulate 32 bits without having to worry about the sign bit.

Another very radical aproach could be to use the type SET to play the role of this low level transport of unsigned 32 bit.
Obviously, one would have to allow ROR and LSL on SETs and forget about this functionality on INTEGERs. I mean: if you think of it: rotating INTEGERs is pretty weird where the the INTEGER is negative and then positive again from bit rotation to bit rotation... makes no sense at all.

br
Jörg

> Am 02.05.2020 um 14:28 schrieb Chris Burrows <chris at cfbsoftware.com>:
> 
> 
>> 
>> -----Original Message-----
>> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of Joerg
>> Sent: Saturday, 2 May 2020 8:54 PM
>> To: ETH Oberon and related systems
>> Subject: Re: [Oberon] Negative integer literals in Oberon
>> 
>> Yes and no.
>> Addresses (as integers) do not exist in Oberon.
>> 
> 
> That is not true. Refer to Section 11.1 The Module System of the Oberon Language Report:
> 
> Function procedures:
> 
> Name: ADR(v)    
> Argument types: any 
> Result type: INTEGER 
> Function: address of variable v
> 
> Regards,
> Chris Burrows
> CFB Software
> https://www.astrobe.com
> 
> 
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon



More information about the Oberon mailing list