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,bda36258b2fe9834 X-Google-Thread: 1094ba,3354bcb01bfd8111 X-Google-Attributes: gid103376,gid1094ba,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada,comp.lang.fortran Subject: Re: Shortcut logicals (was: Re: F200x ) Date: 01 Feb 2005 08:57:54 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1107259211.c5d05dcbf8695b73b67b208313002b2b@teranews> NNTP-Posting-Host: shell01-e.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1107266275 24198 69.38.147.31 (1 Feb 2005 13:57:55 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 1 Feb 2005 13:57:55 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:8111 comp.lang.fortran:10056 Date: 2005-02-01T08:57:54-05:00 List-Id: Martin Krischik writes: > Christoph Grein wrote: > > > > Robert A Duff wrote: > > > > > > > And the syntax rules forbid mixing "and" and "and then" -- you have > > > > to use > > > > parens.??All?of?these?("and",?"and?then",?"or",?"or?else",?"xor") are > > > > lower precedence than most other operators in Ada.??So?you?can write: > > > > > > Are you sure? I did not find anything in the RM to support that. I > > checked > > > both the RM and AARM: > > > of course Robert is sure, if not, who else - you should know, he's > > deeply involved in Ada development. I wouldn't say "of course" -- after all, Martin Dowie pointed out that I got the run time semantics wrong. ;-) > Ok you are right, I am a just bit weak on names. > > > See RM 4.4(2..7). > > For our friends from comp.lang.fortran: You can read it up at > http://www.adaic.com/standards/95lrm/html/RM-4-4.html: > > > You'll find > > relation and relation gives an expression, > > relation and then relation also gives an expression. > > > But there is no syntax rule to combine an expression with a relation. > > You can only combine a parenthesized expression (a primary) with a > > relation. > > Sure, you are right. But that rule means that: > > X or Y and Z > > is not valid either. Yes, that's what it means. You have to say: (X or Y) and Z or X or (Y and Z) in Ada. In maths, folks usually presume that "and" has higher precedence than "or". I'm pretty happy with the Ada rule, though. In general, I don't think programming languages should use precedence and associativity rules beyond the ones folks know by age 9. Many people disagree with that, though -- they think "extra" parens cause too much clutter, and make the code hard to read. - Bob