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: 1094ba,3354bcb01bfd8111 X-Google-Thread: 103376,bda36258b2fe9834 X-Google-Attributes: gid1094ba,gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!wn13feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail From: "James Giles" Newsgroups: comp.lang.fortran,comp.lang.ada References: <41f94cab$1@news1.ethz.ch> <1107060103.157135.325010@z14g2000cwz.googlegroups.com> <8u2pv0tdd9b1v689rtqc2c2tlm9pn9t1t6@4ax.com> <1107085125.849687.318060@c13g2000cwb.googlegroups.com> <1107096062.786125.100030@f14g2000cwb.googlegroups.com> <10vq094k09igv3c@corp.supernews.com> <1107160100.162171.223490@f14g2000cwb.googlegroups.com> Subject: Re: Shortcut logicals (was: Re: F200x ) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1478 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478 Message-ID: Date: Tue, 01 Feb 2005 02:53:45 GMT NNTP-Posting-Host: 12.72.113.133 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1107226425 12.72.113.133 (Tue, 01 Feb 2005 02:53:45 GMT) NNTP-Posting-Date: Tue, 01 Feb 2005 02:53:45 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.fortran:10032 comp.lang.ada:8095 Date: 2005-02-01T02:53:45+00:00 List-Id: James Van Buskirk wrote: > "James Giles" wrote in message > news:i9BLd.316$xR1.179@bgtnsc04-news.ops.worldnet.att.net... > >> Now, not only do I find this confusing, I'm sure it will hide latent >> errors in the code of others. Requiring parentheses or using a >> function-call notation eliminates all ambiguities. Making the new >> operators lower precedence than everything else helps a little. > > Jeez, it took me so much time to punch all that stuff from the > standard in and you didn't even bother to read it. Precedence > has nothing to do with the question of whether cond4 is evaluated > in your original expression. [...] I might say the same thing. On the other hand, you did explicitly state that even if the value of cond1.and.cond2 were .false. the answer still "depends". That seemed like an ambiguous response to me. > [...] Hint: suppose cond4 has rank 1 and > all others are scalar. [...] Hint: suppose they're *all* scalars. I still don't see the subtle point you're making. If it requires me to assume that any of the operands are not scalar befor the answer is apparent, I'll need more than a hint. But it does seem to me that a paragraph beginning "If an array constructor appears ..." it's not immediately obvious how that applies to an example with no arrays at all. Similarly, it's difficult to figure how other things you quote apply when the conditional expression in my example may not even involve WHERE. > [...] Same thing happens in WHERE except that > the question is: how do you do shape matching unless you get > far enough through an expression to determine its shape even > though the mask it will be subjected to is all false? Well, if all the operands are scalar, the shape is pretty obvious. The question isn't shape (or even value). The question is whether the program crashes or continues running. Explain again how the disection of WHERE allows me to decide whether the original example may be legally rearranged (asuming scalar X): x/=0.0 .and. cond2 .andthen. cond3 .and. 5.0/x>10.0 ?=> 5.0/x>10.0 .and. x/=0.0 .and. cond2 .andthen. cond3 or cond2 .andthen. cond3 .and. 5.0/x>10.0 .and. x/=0.0 etc. One of the reasons it took me a while to respond is that I *did* read what you wrote (and couldn't find the subtle relevance you assert) - I've just reread it again. My puzzlement still remains. It does seem to me that the case where all operands are scalar ought to be simpler than more exotic possibilities. And a simple IF (or even a scalar logical assignment statement) ought to be simpler to discuss that a WHERE construct. -- J. Giles "I conclude that there are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies." -- C. A. R. Hoare