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-Thread: 103376,99e73f65ea2533b9 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!nlpi057.nbdc.sbc.com!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: and then... (a curiosity) Date: Tue, 02 Sep 2008 16:37:41 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <18b41828-bda4-4484-8884-ad62ce1c831d@f36g2000hsa.googlegroups.com> <57qdnfULQ9tzKCHVnZ2dnUVZ_tHinZ2d@comcast.com> <48bd0003$1@news.post.ch> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1220387861 1823 192.74.137.71 (2 Sep 2008 20:37:41 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 2 Sep 2008 20:37:41 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:gOTB10s7sA5XsfVdQFH16jllLKI= Xref: g2news2.google.com comp.lang.ada:7606 Date: 2008-09-02T16:37:41-04:00 List-Id: Keith Thompson writes: > follow mathematical notation (in part because there is no single > mathematical notation). If you try to write code that will be > understandable to someone who doesn't know the language, you'll end up > with an overly verbose mess that can hardly be understood by someone > who *does* know the language. > > If I were doing the equivalent of the above in C, whose logical "and" > operator "&&" does do short-circuit evaluation, I probably would > declare the two temporaries. In Ada, it's just not necessary. Perhaps I agree, but this discussion is (at least in part) about language design, not just how to write good Ada (or good C or whatever). At AdaCore, we always say "and then", never "and". I don't like that style (but of course I obey it, because obeying coding conventions is a good thing in itself). It seems to me, side effects on globals in the operands of "and" or "and then" are just plain Bad. The only distinction is whether the right-hand operand makes sense when the left-hand one is False, as in "X /= null and then X.all....". - Bob