[Oberon] Oberon System 3 on WIndows: Why does the step sizein FOR-loop have to be a constant expression?

Jörg Straube joerg.straube at iaeth.ch
Mon Dec 10 01:27:51 CET 2018


Wojtek

«BY» is still in the language. It does not have to be 1. You can increment by 2, 3, 4, 12, 59 whatever, but it has to be constant. If it is a variable take WHILE.

Jörg

Gesendet von Mail für Windows 10

Von: Skulski, Wojciech
Gesendet: Montag, 10. Dezember 2018 01:24
An: ETH Oberon and related systems
Betreff: Re: [Oberon] Oberon System 3 on WIndows: Why does the step sizein FOR-loop have to be a constant expression?

Joerg:

Removing an increment "BY" from a FOR loop looks like a highly questionable optimization to me. I am not sure if the person who made this optimization wrote a lot of data processing code, or any at all. Stepping by an increment other than "1" is a common practice in data processing. 

Wojtek
________________________________________
From: Oberon [oberon-bounces at lists.inf.ethz.ch] on behalf of Jörg Straube [joerg.straube at iaeth.ch]
Sent: Sunday, December 9, 2018 4:15 PM
To: ETH Oberon and related systems
Subject: Re: [Oberon] Oberon System 3 on WIndows: Why does the step size in     FOR-loop have to be a constant expression?

Use WHILE if step size is variable.

Jörg

> Am 09.12.2018 um 17:54 schrieb Dieter <d.gloetzel at web.de>:
>
> On page 273 of "Programming in Oberon" Wirth and Reiser write:
>
> FORStatement = "FOR" ident ":=" expression "TO" expression
>                              ["BY" ConstExpression "DO"]
>                               StatementSequence
>                              "END"
> And indeed when I try to put a variable as step size, the compiler doesn't like it.
>
> This means I cannot write reusable code, which allows to be executed under different conditions with different step sizes.
>
> I am sure, there is some reasoning behind this, but I find it kind-off inconvenient.
>
> Regards, Dieter
>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.inf.ethz.ch_mailman_listinfo_oberon&d=DwIGaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=uUiA_zLpwaGJIlq-_BM9w1wVOuyqPwHi3XzJRa-ybV0&m=-G2bXhw98iRu7ApZv0lM95cj2z2RIfyOYI0lIM_6CoQ&s=JWl3Y6-mrBhYQ2AxFHiCKyuGonRS9IhQi7tVh-gwExc&e=

--
Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.inf.ethz.ch_mailman_listinfo_oberon&d=DwIGaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=uUiA_zLpwaGJIlq-_BM9w1wVOuyqPwHi3XzJRa-ybV0&m=-G2bXhw98iRu7ApZv0lM95cj2z2RIfyOYI0lIM_6CoQ&s=JWl3Y6-mrBhYQ2AxFHiCKyuGonRS9IhQi7tVh-gwExc&e=
--
Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
https://lists.inf.ethz.ch/mailman/listinfo/oberon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20181210/38066239/attachment.html>


More information about the Oberon mailing list