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!news3.google.com!out02a.usenetserver.com!news.usenetserver.com!in04.usenetserver.com!news.usenetserver.com!uns-out.usenetserver.com!news.usenetserver.com!pc02.usenetserver.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: and then... (a curiosity) References: <18b41828-bda4-4484-8884-ad62ce1c831d@f36g2000hsa.googlegroups.com> <57qdnfULQ9tzKCHVnZ2dnUVZ_tHinZ2d@comcast.com> From: Stephen Leake Date: Tue, 02 Sep 2008 21:24:36 -0400 Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (windows-nt) Cancel-Lock: sha1:eNDis9fv/okZkuqwJh+hbdH3Dyo= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 9452e48bddf99c74cf41806630 Xref: g2news2.google.com comp.lang.ada:7613 Date: 2008-09-02T21:24:36-04:00 List-Id: stefan-lucks@see-the.signature writes: > True. But the case that you want both expressions to be evaluated is a > rare exception. On a *logic* level, "A and B" implies "if A is false, the > result is false, regardless of B". It can also be read "if B is false, the result is false, regardless of A". Which is precisely why the Ada semantics are what they are; in some unspecified order: evaluate A, evaluate B compute 'and' of result > So short-circuit evaluation is a natural By 'natural' I suspect you really mean 'what I'm used to from experience'. That's valid, but it's not like it's built into the human genome, or dicated by the laws of physics. It's more of a cultural issue, and therefore it varies from programmer to programmer. > and good thing for a programming language, Why is it "good"? Being the same as what you are used to makes it easy. But when comparing languages, you need more than that. Something like: Given two sets of typical programmers, one thoroughly familiar with language Red, which has C-like boolean operator semantics, and the other thoroughly familiar with language Green, which has Ada-like boolean operator semantics, the number of errors made in using boolean operators is higher in Red than Green. or vice-versa :). I haven't seen anyone make a claim like that. Then you need to get the sets of programmers from China, India, and Serbia to be really valid :). > and it is regrettable that Ada needs a more complex syntax for this. > (Well, "A and B" also implies "if B is false, don't care about A", > but in a programming language you can't have it both ways.) Ah, but you can! That's what speculative execution gives you. Ada allows for that, under user control. In C, you must use nested 'if' to achieve control. -- -- Stephe