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,ace3fca092a457cd X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Newsgroups: comp.lang.ada Path: g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!zen.net.uk!demorgan.zen.co.uk!peernews.mcc.ac.uk!news.mcc.ac.uk!clerew!chl From: "Charles Lindsey" Subject: Re: Unary operator after binary operator: legal or not? => Compiler Error Message-ID: X-Newsreader: NN version 6.5.2 (NOV) References: Date: Thu, 2 Aug 2007 20:44:49 GMT Xref: g2news2.google.com comp.lang.ada:1346 Date: 2007-08-02T20:44:49+00:00 List-Id: In Robert A Duff writes: >"Dmitry A. Kazakov" writes: >> On Tue, 31 Jul 2007 11:05:05 -0400, Robert A Duff wrote: >> >>> If there's a bug, it's a bug in the language definition. ;-) >> >> But not in this place. There should be user-defined subtypes, which would >> eliminate any need in tricks like defining nonsensical "+", just in order >> to have a shortest possible name for the conversion, which otherwise should >> be automatic. >Agreed. >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 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 and even there it is only the method of parsing that changes. The result is actually the same. (INT x = 2 ;print((x*-3, --x,-2^2,x-2^2)) ) which prints STARTING ... -6 +2 +4 -2 ... AND YET ANOTHER ALGOL68 PROGRAM RUNS TO COMPLETION CPU 0.17 >- Bob -- Charles H. Lindsey ---------At Home, doing my own thing------------------------ Tel: +44 161 436 6131 Fax: +44 161 436 6133 Web: http://www.cs.man.ac.uk/~chl Email: chl@clerew.man.ac.uk Snail: 5 Clerewood Ave, CHEADLE, SK8 3JU, U.K. PGP: 2C15F1A9 Fingerprint: 73 6D C2 51 93 A0 01 E7 65 E8 64 7E 14 A4 AB A5