From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,db5c6b2ef47d4b9e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-20 15:22:21 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: "Beard, Frank" Newsgroups: comp.lang.ada Subject: RE: short-circuit control forms Date: Wed, 20 Jun 2001 18:20:26 -0400 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: avanie.enst.fr 993075740 79680 137.194.161.2 (20 Jun 2001 22:22:20 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 20 Jun 2001 22:22:20 +0000 (UTC) To: "'comp.lang.ada@ada.eu.org'" Return-Path: X-Mailer: Internet Mail Service (5.5.2448.0) Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.4 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:8944 Date: 2001-06-20T18:20:26-04:00 -----Original Message----- From: Marin David Condic [mailto:marin.condic.auntie.spam@pacemicro.com] > Better to have the short-circuit things optional so you can manually enable > and disable the behavior as needed. Most of the time the extra efficiency is > likely to be a) too small to sweat and b) not an issue because it isn't a > hard realtime system. Well, the argument could be made that if your second condition raised an exception then your unit testing was insufficient (and yes I know unit tests can't always catch everything). And as a general rule, it's a bad idea to write functions with side effects, unless you have some glaring necessity to do so. Most, if not all, of the conditional statements that I've written fall into the "and then" and "or else" category. But as a point Marin has already made, I don't even worry about any of these cases unless there is some runtime penalty. In most cases, I just use "and" and "or" because the code is cleaner looking. I still would have preferred the short-circuit to be the default. "And then" could have meant, "if this part is true then check the next part". Or change "and then" to "and also". if A and also B then "Or else" is confusing either way. All that aside, I can live with the way it is currently. It's not a big deal. I was just stating a preference. And as I said, I don't actually worry about it until it becomes a problem. Frank Beard