comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: GNAT messages and the not operator (pitfall alert!)
Date: 1996/11/18
Date: 1996-11-18T00:00:00+00:00	[thread overview]
Message-ID: <dewar.848353627@merv> (raw)
In-Reply-To: 32908796.294D@watson.ibm.com


Norman Cohen says

"they assumed that this was a question about the semantics of mod for
negative operands rather than a question about precedence rules, since
interesting questions are more often questions of semantics rather than
syntax, and familiarity with the behavior of rem and mod for negative
operands is a good litmus test of Ada expertise.  Thus distracted from
questions of precedence, they intuitively interpreted the expression
incorrectly.  Whatever the language rules say, the brain apparently
tends to see a unary minus as binding more tightly than a word
surrounded by spaces.  Perhaps writing"

   I think that misses the point, there are two other reasons why
   -5 mod 4 looks like (-5) mod 4 to most people:

   1. Almost all other languages give unary operators higher precedence

   2. People think of -5 as a negative literal, even though it is not.
      Most of the time, you can't tell the difference, and if unary
      operators have higher precedence than any binary operator, then
      this is even more true (a very good reason for making unary
      operators have higher precedence, one that for some reason got
      ignored in the Ada design.






  reply	other threads:[~1996-11-18  0:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-24  0:00 GNAT messages and the not operator (pitfall alert!) Robert Dewar
1996-10-24  0:00 ` Robert Dewar
1996-10-25  0:00   ` whiting_ms@corning.com (Matt Whiting)
1996-10-26  0:00     ` David C. Hoos, Sr.
1996-10-27  0:00     ` Robert Dewar
1996-10-28  0:00       ` Matthew S. Whiting
1996-10-26  0:00   ` John Herro
1996-10-26  0:00     ` Robert Dewar
1996-10-29  0:00       ` John Herro
1996-10-29  0:00         ` Robert Dewar
1996-10-26  0:00     ` Matthew Heaney
1996-10-29  0:00       ` Robert Dewar
1996-10-30  0:00     ` Dr. Peter E. Obermayer
1996-10-30  0:00       ` John Herro
1996-10-30  0:00         ` Robert Dewar
1996-11-01  0:00         ` User Password expiration date extractor? Stein-Aksel Basma
1996-10-29  0:00   ` GNAT messages and the not operator (pitfall alert!) Norman H. Cohen
1996-10-29  0:00     ` whiting_ms@corning.com (Matt Whiting)
1996-10-30  0:00       ` Robert Dewar
1996-10-30  0:00       ` Norman H. Cohen
1996-11-06  0:00         ` Richard A. O'Keefe
1996-11-18  0:00           ` Norman H. Cohen
1996-11-18  0:00             ` Robert Dewar [this message]
1996-10-30  0:00       ` David C. Hoos, Sr.
1996-10-30  0:00         ` whiting_ms@corning.com (Matt Whiting)
1996-10-30  0:00           ` Norman H. Cohen
1996-11-05  0:00     ` Robert Dewar
1996-10-28  0:00 ` Cary Jamison
1996-10-29  0:00   ` Robert Dewar
replies disabled

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