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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3b4bed4f74b8ac49 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: GNAT messages and the not operator (pitfall alert!) Date: 1996/11/18 Message-ID: #1/1 X-Deja-AN: 197381485 references: <32762A30.D2D@watson.ibm.com> <1996Oct29.145959.1@corning.com> <327771EE.1237@watson.ibm.com> <55p8b6$l29$1@goanna.cs.rmit.edu.au> <32908796.294D@watson.ibm.com> organization: New York University newsgroups: comp.lang.ada Date: 1996-11-18T00:00:00+00:00 List-Id: 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.