Hi Thom, On 06.09.2020 02:08, ts2261 wrote: > Well. I am confused. I believed the computer did the short circuiting > automatically on these > boolean expressions.
This is what most programming languages do, not the "computers" per se. Rexx is different: conjunctions and disjunctions will evaluate always all their expressions yielding the truth values. > What does the new coding style do to help? As short-circuiting has its uses people have asked short-circuiting from ooRexx and it was made available for conjunctions by using the comma character as the operator that delimits the individual boolean values (maybe as a result of an expression). Once a .false value is encountered the short-circuiting takes place. There have been requests in the past to also allow short-circuing disjunctions. The challenge is, how could one express them in ooRexx. ---rony > > > -------- Original message -------- > From: "Rony G. Flatscher" <rony.flatsc...@wu.ac.at> > Date: 9/5/20 13:40 (GMT-06:00) > To: oorexx-devel@lists.sourceforge.net > Subject: Re: [Oorexx-devel] Short cutting logical operators > > 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 > > >> >> On Fri, Sep 4, 2020 at 3:05 PM Rick McGuire <object.r...@gmail.com >> <mailto:object.r...@gmail.com>> wrote: >> >> There's been a bit of a discussion about the short-cutting conditional >> lists implemented by >> IF, WHEN, et al. I find that construct very useful, but as the >> discussion on the list has >> revealed, it has its limitations. >> >> It would actually be fairly trivial to implement AND and OR operators >> that can do short-cut >> evaluation. Of course, this is not possible for XOR, which always >> requires both values. The >> real questions are 1) should it be done and 2) what should the operator >> be. I've been >> tentatively using *& and *| in my thinking about this, but there are >> certainly other >> possibilities. >> >> Rick >>
_______________________________________________ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel