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!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s22.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: and then... (a curiosity) References: <18b41828-bda4-4484-8884-ad62ce1c831d@f36g2000hsa.googlegroups.com> <09fad49e-95d9-4ffc-a0bd-d68d14a0f901@b2g2000prf.googlegroups.com> In-Reply-To: <09fad49e-95d9-4ffc-a0bd-d68d14a0f901@b2g2000prf.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s22 1220058394 12.201.97.213 (Sat, 30 Aug 2008 01:06:34 GMT) NNTP-Posting-Date: Sat, 30 Aug 2008 01:06:34 GMT Organization: AT&T ASP.att.net Date: Sat, 30 Aug 2008 01:06:34 GMT Xref: g2news2.google.com comp.lang.ada:7557 Date: 2008-08-30T01:06:34+00:00 List-Id: Adam Beneschan wrote: > > "and then" is not a function, however, and has none of these > properties. > > To make "and" [and "or"] on two Booleans behave like the short-circuit > form would introduce a major inconsistency into the language. In addition to the other reasons, there's the question of processor optimization. Although we have a sequential view of how code is executed, modern processors do all sorts of strange optimizations, such as speculative execution, that violate that sequential view. It's my understanding that the short-circuit forms can prevent such optimizations. Apparently, code that may evaluate only one of the 2 expressions can actually be slower than code that must evaluate both. -- Jeff Carter "If I could find a sheriff who so offends the citizens of Rock Ridge that his very appearance would drive them out of town ... but where would I find such a man? Why am I asking you?" Blazing Saddles 37