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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,25aa3c7e1b59f7b5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-04 03:51:34 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!chcgil2-snf1.gtei.net!news.gtei.net!news.binc.net!kilgallen From: Kilgallen@SpamCop.net (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: A case where Ada defaults to unsafe? Date: 4 Jan 2002 05:51:26 -0600 Organization: LJK Software Message-ID: References: <3C34BF2C.6030500@mail.com> <3C35675D.276C2D81@canal-plus.fr> NNTP-Posting-Host: eisner.encompasserve.org X-Trace: grandcanyon.binc.net 1010145089 22168 192.135.80.34 (4 Jan 2002 11:51:29 GMT) X-Complaints-To: abuse@binc.net NNTP-Posting-Date: Fri, 4 Jan 2002 11:51:29 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:18513 Date: 2002-01-04T05:51:26-06:00 List-Id: In article <3C35675D.276C2D81@canal-plus.fr>, Thierry Lelegard writes: > Maybe the actual question should be "why are there two distinct formats, > with and without short-circuit?" > > "and then" has an actual added value over "and" (the short-circuit). > On the other hand, what is the added value of "and"? What can be > achieved by "and" that could not be by "and then" (except side-effect, > which is a dirty practice)? > > If have been using Ada for 16 years and I have never understood why there > are two formats. Let's assume that "and then" never existed and that "and" > was defined as short-circuit (same for "or" and "or else"). Wouldn't it > be better (safer) for everyone? You say "better (safer)", but performance-sensitive applications may need the speed provided by letting the compiler optimize away one evaluation. For simpler cases, the compiler can decide which branch to evaluate first, based on likely performance characteristics. For more complex cases, the programmer can specify an order with the "and then" operator.