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

Skulski, Wojciech skulski at pas.rochester.edu
Mon Dec 10 01:23:25 CET 2018


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=


More information about the Oberon mailing list