From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Unary operator after binary operator: legal or not? => Compiler Error
Date: Fri, 3 Aug 2007 09:51:59 +0200
Date: 2007-08-03T09:48:00+02:00 [thread overview]
Message-ID: <10t584xwu3tyb.1reyfdmws2k5k$.dlg@40tude.net> (raw)
In-Reply-To: JM5yyp.Azp@clerew.man.ac.uk
On Thu, 2 Aug 2007 20:44:49 GMT, Charles Lindsey wrote:
> In <wccy7gwa7sh.fsf@shell01.TheWorld.com> Robert A Duff <bobduff@shell01.TheWorld.com> writes:
>
>>But don't you think:
>
>> X * -3
>
>>ought to be legal (no user-defined operators in sight)?
>
> Interestingly, that example works in ALGOL 68, which generally speaking is
> as pernickety a language as you are likely to get.
>
> --x works too. Essentially, all the monadic operators have a higher
> preference than the dyadic ones.
The Ada's rule is not about precedence it is about association. Unary minus
does not associate with itself in Ada. This was a deliberate decision.
> The only case where this turns out to be a little odd is
>
> -2^2
>
> which is to be contrasted with the effect of
> x-2^2
No problem, if you wanted -2**2 |= -(2**2), but 2**-2 |= 2**(-2), you would
just extend the precedence model, see
http://www.dmitry-kazakov.de/ada/components.htm#Parsers_etc
(chapter 8.2.2)
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2007-08-03 7:51 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-30 22:52 Unary operator after binary operator: legal or not? Jeffrey R. Carter
2007-07-30 23:39 ` Markus E.L.
2007-07-31 0:22 ` Adam Beneschan
2007-07-31 21:52 ` Jeffrey R. Carter
2007-07-31 8:01 ` anon
2007-07-31 8:16 ` Unary operator after binary operator: legal or not? => Compiler Error anon
2007-07-31 8:38 ` AW: Unary operator after binary operator: legal or not? => CompilerError Grein, Christoph (Fa. ESG)
2007-07-31 15:05 ` Unary operator after binary operator: legal or not? => Compiler Error Robert A Duff
2007-07-31 15:39 ` Dmitry A. Kazakov
2007-07-31 15:53 ` Robert A Duff
2007-07-31 17:02 ` Georg Bauhaus
2007-07-31 19:17 ` Adam Beneschan
2007-08-01 7:16 ` Maciej Sobczak
2007-08-01 15:23 ` Adam Beneschan
2007-07-31 20:59 ` Robert A Duff
2007-08-01 7:24 ` Georg Bauhaus
2007-08-01 8:02 ` Dmitry A. Kazakov
2007-08-01 8:17 ` AW: Unary operator after binary operator: legal or not? => CompilerError Grein, Christoph (Fa. ESG)
2007-08-01 10:10 ` Ian Clifton
2007-08-01 9:34 ` Unary operator after binary operator: legal or not? => Compiler Error Georg Bauhaus
2007-08-01 21:51 ` Jeffrey R. Carter
2007-07-31 17:52 ` Dmitry A. Kazakov
2007-08-02 20:44 ` Charles Lindsey
2007-08-03 7:48 ` Stuart
2007-08-03 7:51 ` Dmitry A. Kazakov [this message]
2007-07-31 23:22 ` anon
2007-08-01 0:13 ` Adam Beneschan
2007-08-01 6:20 ` Unary operator after binary operator: legal or not? => Illegal anon
2007-08-01 5:34 ` AW: Unary operator after binary operator: legal or not? => CompilerError Grein, Christoph (Fa. ESG)
2007-08-01 6:46 ` To := Grein, Christoph (Fa. ESG) anon
2007-08-01 7:11 ` AW: " Grein, Christoph (Fa. ESG)
2007-08-02 6:52 ` anon
2007-08-02 8:56 ` AW: " Grein, Christoph (Fa. ESG)
2007-08-02 22:29 ` Markus E.L. 2
2007-08-02 23:02 ` tmoran
2007-08-02 23:11 ` Ed Falis
2007-08-02 23:34 ` Markus E.L. 2
2007-08-03 4:42 ` AW: " Grein, Christoph (Fa. ESG)
2007-08-02 22:28 ` Markus E.L. 2
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox