On 06.09.2020 18:42, Mike Cowlishaw wrote: > > > On 05.09.2020 21:48, Mike Cowlishaw wrote: >> Rony, this was added to NetRexx back in the 1990s. > > yes, this also meant that translating NetRexx to Java would be > straight-forward, but NetRexx > broke compatibility with Rexx in that respect (which has not been a > problem). > > > > I don't follow .. the shortcircuit in NetRexx uses a comma in a place that > was not > allowed/possible in Rexx: > > Multiple expressions, separated by commas, can be given on the *if > *clause, which then has the > syntax: > > *if */expression/[, /expression/]... [;] > > In this case, the expressions are evaluated in turn from left to right, > and if the result of > any evaluation is 1 then the test has succeeded and the instruction > following the associated > *then *clause is executed. If all the expressions evaluate to 0 and an > *else *was given then > the instruction after the *else *is executed. > > Note that once an expression evaluation has resulted in 1, no further > expressions in the > clause are evaluated. So, for example, in: > > -- assume 'name' is a string > if name=null, name='' then say 'Empty' > > then if name does not refer to an object it will compare equal to null > and the *say > *instruction will be executed without evaluating the second expression in > the *if *clause. > > How does that break compatibility with Rexx? > The code does not run on Rexx, here an example feeding your example to Regina:
G:\test\regina\work>regina -v regina: REXX-Regina_3.9.3(MT) 5.00 5 Oct 2019 (32 bit) G:\test\regina\work>type testshortcirc.rex -- assume 'name' is a string if name=null, name='' then say 'Empty' G:\test\regina\work>regina testshortcirc.rex Error 18 running "G:\test\regina\work\testshortcirc.rex", line 2: THEN expected Error 18.1: IF keyword on line 2 requires matching THEN clause; found ", " ---rony
_______________________________________________ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel