On 06.09.2020 20:52, WalterPachl wrote: ... cut ... > so the commas are ands with shortcut > > Rony's notation seems clear/er/ &, and |, > Well, it was Erich suggesting them as a possibility, I just spelled the effect out:
On 05.09.2020 20:39, Rony G. Flatscher wrote: > On 04.09.2020 15:17, Erich Steinböck wrote: >> I'm in favor of this proposal. >> To follow our existing shortcut-style with commas (note that although almost all of our current comma-shortcuts are AND-style, we also have an OR-style comma-shortcut for a WHEN in a SELECT CASE) we might use and-comma (&,) and or-comma (|,) as operators. > > As Rick allows the comma "," to indicate short-circuiting conjunctions, then this could be seen as a short version of "&," taking the '&' as optional in this case. Using "|," for a short-circuiting disjunction would then be logical :). > > So samples might look like: > > -- conjunction: > if a=.true , b=.false , c=.true then ... > > if a=.true &, b=.false &, c=.true then ... -- same as above > > -- disjunction: > if a=.true |, b=.false |, c=.true then ... > > In this case the comma after the logical operator indicates short-circuiting. > > This mostlikely can be understood by students who get exposed to this notation (just needing to memorize that a trailing comma indicates short-circuiting for conjunctions and disjunctions). > > So in favor for this suggested syntax: +1 > > ---rony Starting out with the standard Rexx conjunctions and disjunctions: if a=.true & b=.false & c=.true then ... -- classic Rexx, all expressions get evaluated if a=.true | b=.false | c=.true then ... -- classic Rexx, all expressions get evaluated Introducing a trailing comma after a logical operator to indicate a short-circuit evaluation would look like: if a=.true &, b=.false &, c=.true then ... -- short-circuit if an expression yields .false if a=.true |, b=.false |, c=.true then ... -- short-circuit if an expression yields .true This way the logical operators remain and the trailing comma indicates a short-circuit where the programmer desires it. IMHO the comma is an eye-catcher here making it very clear where a short-circuit takes place. As there are probably quite a lot of programs out there which use ooRexx 5 short-circuiting of conjunctions, compatibility could be established by allowing the & logical operator to be optional in the case of a a short-circuit with commas only. ---rony P.S.: Unfortunately, the semantics of comma-separated expressions in ooRexx (short-circuit conjunction) is not the same as in NetRexx (short-circuit disjunction). However, if in ooRexx short-circuiting is done supplying the logical operator then misunderstandings/misconceptions can be easily avoided as the logical operator could/would remain in place.
_______________________________________________ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel