comp.lang.ada
 help / color / mirror / Atom feed
From: "James Giles" <jamesgiles@worldnet.att.net>
Subject: Re: Shortcut logicals (was: Re: F200x )
Date: Tue, 01 Feb 2005 02:53:45 GMT
Date: 2005-02-01T02:53:45+00:00	[thread overview]
Message-ID: <ZaCLd.474$xR1.216@bgtnsc04-news.ops.worldnet.att.net> (raw)
In-Reply-To: Kc6dnWsfnrh4dWPcRVn-vA@comcast.com

James Van Buskirk wrote:
> "James Giles" <jamesgiles@worldnet.att.net> 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





  reply	other threads:[~2005-02-01  2:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <41f94cab$1@news1.ethz.ch>
     [not found] ` <INfKd.13707$bh6.378409@weber.videotron.net>
     [not found]   ` <nospam-6F7AE0.11340228012005@news.supernews.com>
     [not found]     ` <lqjnv01969glk2mbv1plvjdn5idkb1c3db@4ax.com>
     [not found]       ` <1107060103.157135.325010@z14g2000cwz.googlegroups.com>
     [not found]         ` <8u2pv0tdd9b1v689rtqc2c2tlm9pn9t1t6@4ax.com>
     [not found]           ` <1107085125.849687.318060@c13g2000cwb.googlegroups.com>
     [not found]             ` <1107096062.786125.100030@f14g2000cwb.googlegroups.com>
     [not found]               ` <10vq094k09igv3c@corp.supernews.com>
     [not found]                 ` <eudLd.43724$8u5.37685@bgtnsc04-news.ops.worldnet.att.net>
     [not found]                   ` <1107160100.162171.223490@f14g2000cwb.googlegroups.com>
     [not found]                     ` <cTxLd.126318$w62.46060@bgtnsc05-news.ops.worldnet.att.net>
     [not found]                       ` <xfKdnUflrtW3I2PcRVn-og@comcast.com>
     [not found]                         ` <rEzLd.68$xR1.54@bgtnsc04-news.ops.worldnet.att.net>
     [not found]                           ` <ON-dnSQzGfXOVWPcRVn-1A@comcast.com>
     [not found]                             ` <mXzLd.100$xR1.94@bgtnsc04-news.ops.worldnet.att.net>
2005-02-01  0:56                               ` Shortcut logicals (was: Re: F200x ) James Van Buskirk
2005-02-01  1:16                                 ` Robert A Duff
2005-02-01  6:49                                   ` Shortcut logicals Martin Dowie
2005-02-01 13:46                                     ` Robert A Duff
2005-02-01  8:08                                   ` Shortcut logicals (was: Re: F200x ) Martin Krischik
2005-02-01  1:43                                 ` James Giles
2005-02-01  2:33                                   ` James Van Buskirk
2005-02-01  2:53                                     ` James Giles [this message]
2005-02-01  3:49                                       ` James Van Buskirk
2005-02-01  4:31                                         ` James Giles
2005-02-01  8:49 Christoph Grein
2005-02-01 11:43 ` Martin Krischik
2005-02-01 12:45   ` Adrien Plisson
2005-02-01 14:03     ` Martin Krischik
2005-02-01 14:56       ` Les
2005-02-01 16:57       ` Frank J. Lhota
2005-02-01 17:55       ` Dan Nagle
2005-02-01 18:25         ` James Giles
2005-02-01 13:57   ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox