Due to writing more Classic Rexx than before I occasionally use DO instead of LOOP - and then I am warned, over 3 lines, like:
18 +++ do i=today to 900000 +++ ^ +++ Warning: Wrong syntax for DO; retrying as a LOOP instruction But, then it just works. When I write ooRexx I can use LOOP and not be warned. So I wonder, should we remove this warning, and accept DO as an equivalent of LOOP in this case? What do we think? best regards, René. _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
I have fallen into the same "trap." [Maybe it shows my age -- too many years of Classic Rexx (and Kex).] I'm also presuming you fell into the reverse trap and meant "When I write ooRexx I can use DO and not be warned." As a NetRexx user, and not cognizant of all its internals, I'd vote to remove the warning, and update the documentation. Jeff On 2/20/2021 5:25 AM, René Jansen
wrote:
Due to writing more Classic Rexx than before I occasionally use DO instead of LOOP - and then I am warned, over 3 lines, like: 18 +++ do i=today to 900000 +++ ^ +++ Warning: Wrong syntax for DO; retrying as a LOOP instruction But, then it just works. When I write ooRexx I can use LOOP and not be warned. So I wonder, should we remove this warning, and accept DO as an equivalent of LOOP in this case? What do we think? best regards, René. _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
There is a subtle difference between "loop" and "do": say "loop" i=1 loop say "i:" i i=i+1 if i>10 then leave end say "---" say "do" i=1 do say "i:" i i=i+1 if i>10 then leave end yields under ooRexx: G:\test\oorexx\netrexx>testDoLoop.rex loop i: 1 i: 2 i: 3 i: 4 i: 5 i: 6 i: 7 i: 8 i: 9 i: 10 --- do i: 1 ---rony
On 20.02.2021 12:49, Jeff Hennick
wrote:
I have fallen into the same "trap." [Maybe it shows my age -- too... _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
And in NetRexx it gives this error: 15 +++ if i>10 then leave With that line commented out, it gives
the same results as in ooRexx.
----
So we can say DO is a synonym for LOOP,
but LOOP is *not* a synonym for DO in both dialects.
Jeff
On 2/20/2021 8:01 AM, Rony G. Flatscher
wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by rvjansen
'DO' as a loop isn't in the NetRexx language, so this is a language change rather than 'removing a warning'. One of the things that's 'cleaner' about NetRexx compared to OORexx is that the former doesn't have all sorts of baggage added in just because some implementer could add them at some time. Using DO for a loop was my mistake in REX because I didn't want to be too different from PL/I (which made the original mistake). James Gosling admits that he made the same mistake in Java (curly braces for loops because he didn't want to be too different from C/C++). I wish I had thought to use LOOP for loops back in 1979 ... So it comes down to: does one really want 'alternative' keywords for instructions? The DO instruction would have to note that 'what looks like a DO might actually be a LOOP' and the LOOP instruction would have to state the 'alternative' spelling of the keyword. Mike > -----Original Message----- > Subject: [Ibm-netrexx] loop - do warning > > Due to writing more Classic Rexx than before I occasionally > use DO instead of LOOP - and then I am warned, over 3 lines, like: > > 18 +++ do i=today to 900000 > +++ ^ > +++ Warning: Wrong syntax for DO; retrying as a LOOP instruction > > But, then it just works. When I write ooRexx I can use LOOP > and not be warned. So I wonder, should we remove this > warning, and accept DO as an equivalent of LOOP in this case? > What do we think? _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
If I read the Language Reference correctly (V2 to V4), do i=x to y is incorrect syntax, as Mike writes.
<< do [label name] [protect term] [binary]; instructionlist [catch [vare =] exception; instructionlist]... [finally[;] instructionlist] end [name]; where name is a non-numeric symbol and instructionlist is zero or more instructions >> Reading the code, it used to be flagged as an error and changed somewhere along the line. The original RxError is still there, commented out. Git does not show this committed change, it's there since infire's initial commit to the repo in 2011. NrDo.nrx: otherwise -- signal RxError(rxt, tok, 'do.keyword.expected') RxWarn(rxt, tok, 'wrong.do.syntax.retry') parser.scraplevel()-- discard the level that we added loopitem=NrLoop(rxt) -- and give it a retry as a LOOP parser.cursor.curclause.lookaside=loopitem -- replace the NrDo object loopitem.scan(rxt.pass) return -- [no more joy here] I, for one, do not like this alternative, and vote to flag as error again, but this could break existing running code.. Marc On 2/20/21 3:51 PM, Mike Cowlishaw wrote: > > 'DO' as a loop isn't in the NetRexx language, so this is a language change > rather than 'removing a warning'. One of the things that's 'cleaner' about > NetRexx compared to OORexx is that the former doesn't have all sorts of > baggage added in just because some implementer could add them at some time. > > Using DO for a loop was my mistake in REX because I didn't want to be too > different from PL/I (which made the original mistake). James Gosling admits > that he made the same mistake in Java (curly braces for loops because he > didn't want to be too different from C/C++). I wish I had thought to use > LOOP for loops back in 1979 ... > > So it comes down to: does one really want 'alternative' keywords for > instructions? The DO instruction would have to note that 'what looks like > a DO might actually be a LOOP' and the LOOP instruction would have to state > the 'alternative' spelling of the keyword. > > Mike > > >> -----Original Message----- >> Subject: [Ibm-netrexx] loop - do warning >> >> Due to writing more Classic Rexx than before I occasionally >> use DO instead of LOOP - and then I am warned, over 3 lines, like: >> >> 18 +++ do i=today to 900000 >> +++ ^ >> +++ Warning: Wrong syntax for DO; retrying as a LOOP instruction >> >> But, then it just works. When I write ooRexx I can use LOOP >> and not be warned. So I wonder, should we remove this >> warning, and accept DO as an equivalent of LOOP in this case? >> What do we think? > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > Online Archive : https://urldefense.proofpoint.com/v2/url?u=http-3A__ibm-2Dnetrexx.215625.n3.nabble.com_&d=DwIDaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV1za02NiR4PUelvicfHXwtnTXpXE&m=9Wnk6qU-AFFNv-9DfBWw4W4l8qTKGKUgymRY8sPIFZg&s=q960KcImLRsH8-LJEd1QFHnJqZdL9VNYACfcdOhFMqE&e= > Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by Mike Cowlishaw
I see, and I just wanted to say then why we don’t just flag it as an error, when Marc’s mail came in. As this change seems not to be properly discussed and agreed upon, I am in favour of taking it out again. Let’s do that in 4.02 so we can deprecate it and give a proper warning.
It will break some ‘dual mode’ execs I have, but that is no big deal. We should properly discuss this at some time, but in a context of other compatibility changes. René. > On 20 Feb 2021, at 15:53, Mike Cowlishaw <[hidden email]> wrote: > > > 'DO' as a loop isn't in the NetRexx language, so this is a language change > rather than 'removing a warning'. One of the things that's 'cleaner' about > NetRexx compared to OORexx is that the former doesn't have all sorts of > baggage added in just because some implementer could add them at some time. > > Using DO for a loop was my mistake in REX because I didn't want to be too > different from PL/I (which made the original mistake). James Gosling admits > that he made the same mistake in Java (curly braces for loops because he > didn't want to be too different from C/C++). I wish I had thought to use > LOOP for loops back in 1979 ... > > So it comes down to: does one really want 'alternative' keywords for > instructions? The DO instruction would have to note that 'what looks like > a DO might actually be a LOOP' and the LOOP instruction would have to state > the 'alternative' spelling of the keyword. > > Mike > > >> -----Original Message----- >> Subject: [Ibm-netrexx] loop - do warning >> >> Due to writing more Classic Rexx than before I occasionally >> use DO instead of LOOP - and then I am warned, over 3 lines, like: >> >> 18 +++ do i=today to 900000 >> +++ ^ >> +++ Warning: Wrong syntax for DO; retrying as a LOOP instruction >> >> But, then it just works. When I write ooRexx I can use LOOP >> and not be warned. So I wonder, should we remove this >> warning, and accept DO as an equivalent of LOOP in this case? >> What do we think? > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > Online Archive : https://urldefense.proofpoint.com/v2/url?u=http-3A__ibm-2Dnetrexx.215625.n3.nabble.com_&d=DwIFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV1za02NiR4PUelvicfHXwtnTXpXE&m=scjqifGoDawKIc6hh2HzrxpmHEsKH_4aTOgHZNAqDJs&s=r-QxSZau_nLcHnP6HL5YPim6YPGx7TyMjr61CJeA6DU&e= > _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
OK. Fairly sure the warning is/was in the original code (i.e., when the
NetRexx team was just me). I think the idea was to flag the error but without the programmer having to need to edit and recompile if that was the only thing wrong. Mike > -----Original Message----- > From: Ibm-netrexx > [mailto:[hidden email]] On Behalf Of > [hidden email] > Sent: 20 February 2021 18:51 > To: IBM Netrexx > Subject: Re: [Ibm-netrexx] loop - do warning > > I see, and I just wanted to say then why we dont just flag > it as an error, when Marcs mail came in. As this change > seems not to be properly discussed and agreed upon, I am in > favour of taking it out again. Lets do that in 4.02 so we > can deprecate it and give a proper warning. > > It will break some dual mode execs I have, but that is no > big deal. We should properly discuss this at some time, but > in a context of other compatibility changes. > > René. > > > On 20 Feb 2021, at 15:53, Mike Cowlishaw > <[hidden email]> wrote: > > > > ? > > 'DO' as a loop isn't in the NetRexx language, so this is a language > > change rather than 'removing a warning'. One of the things that's > > 'cleaner' about NetRexx compared to OORexx is that the > former doesn't > > have all sorts of baggage added in just because some > implementer could add them at some time. > > > > Using DO for a loop was my mistake in REX because I didn't > want to be > > too different from PL/I (which made the original mistake). James > > Gosling admits that he made the same mistake in Java (curly > braces for > > loops because he didn't want to be too different from > C/C++). I wish > > I had thought to use LOOP for loops back in 1979 ... > > > > So it comes down to: does one really want 'alternative' keywords for > > instructions? The DO instruction would have to note that > 'what looks like > > a DO might actually be a LOOP' and the LOOP instruction > would have to > > state the 'alternative' spelling of the keyword. > > > > Mike > > > > > >> -----Original Message----- > >> Subject: [Ibm-netrexx] loop - do warning > >> > >> Due to writing more Classic Rexx than before I occasionally use DO > >> instead of LOOP - and then I am warned, over 3 lines, like: > >> > >> 18 +++ do i=today to 900000 > >> +++ ^ > >> +++ Warning: Wrong syntax for DO; retrying as a LOOP instruction > >> > >> But, then it just works. When I write ooRexx I can use > LOOP and not > >> be warned. So I wonder, should we remove this warning, and > accept DO > >> as an equivalent of LOOP in this case? > >> What do we think? > > > > _______________________________________________ > > Ibm-netrexx mailing list > > [hidden email] > > Online Archive : > > > https://urldefense.proofpoint.com/v2/url?u=http-3A__ibm-2Dnetrexx.2156 > > > 25.n3.nabble.com_&d=DwIFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV > > > 1za02NiR4PUelvicfHXwtnTXpXE&m=scjqifGoDawKIc6hh2HzrxpmHEsKH_4aTOgHZNAq > > DJs&s=r-QxSZau_nLcHnP6HL5YPim6YPGx7TyMjr61CJeA6DU&e= > > > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > Online Archive : https://urldefense.proofpoint.com/v2/url?u=http-3A__ibm-2Dnetrexx.215625.n3.nabble.com_&d=DwIFAw&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV1za02NiR4PUelvicfHXwtnTXpXE&m=-LcaoIEi7HEZSz-Cp_4w4Sl_0tzLN9ZvMJxTnyTtaLo&s=743bbg1Fi29VEuSVDt2M7dKLCW7S6AgptHgxGTWt2WQ&e= > > _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Free forum by Nabble | Edit this page |