[Oberon] Easter eggs in Oberon
Chris Burrows
chris at cfbsoftware.com
Mon Apr 13 23:59:18 CEST 2020
> -----Original Message-----
> From: Joerg [mailto:joerg.straube at iaeth.ch]
> Sent: Tuesday, 14 April 2020 6:08 AM
> To: chris at cfbsoftware.com; ETH Oberon and related systems
> Subject: Re: [Oberon] Easter eggs in Oberon
>
> Chris
>
> Why is there an INC if you have +
This is now a questionable feature. One possible justification I can think of is for backwards compatibility. It was intended to be a hint for the compiler to generate more efficient code for the special case where a and b are the same variable in the statement a := b + 1
Similar, but not equivalent to, the use of i++ instead of i = i + 1 in other languages.
> Why is there an ASR if there is a DIV
The use of ASR helps the programmer to indicate to the reader that the data that is being operated on represents a bit pattern with a specific / peculiar meaning rather than a numeric quantity where the concept of remainder / modulus has to be defined.
> Why is there an LSL if there is a *
>
The use of LSL helps the programmer to indicate to the reader that the data that is being operated on represents a bit pattern with a specific / peculiar meaning rather than a numeric quantity where the concept of sign is relevant.
> Why do you have to change THREE things when going from INTEGER to REAL
> i := i DIV 5;
> r := FLT(i) / 5.0
>
To help inexperienced / incompetent programmers from shooting themselves in the foot.
Regards,
Chris
> J rg
>
> > Am 13.04.2020 um 22:25 schrieb Chris Burrows <chris at cfbsoftware.com>:
> >
> > ?Nobody forbids you state that equivalence but as it is not stated in the
> report it is an assumption you have made. Such an equivalence would make no
> practical sense to me. Why would it be necessary to have a separate DIV
> operator if it were true?
> >
> >> -----Original Message-----
> >> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> >> Joerg
> >> Sent: Tuesday, 14 April 2020 4:50 AM
> >> To: ETH Oberon and related systems
> >> Subject: Re: [Oberon] Easter eggs in Oberon
> >>
> >> August
> >>
> >> Where is defined what the operator / shall do?
> >> I mean who does forbid me to state / is equal to DIV if both operands
> >> are INTEGER.
> >>
> >> br
> >> J rg
> >>
> >
> > --
> > 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