From: "Charles Lindsey" <chl@clerew.man.ac.uk>
Subject: Re: Unary operator after binary operator: legal or not? => Compiler Error
Date: Thu, 2 Aug 2007 20:44:49 GMT
Date: 2007-08-02T20:44:49+00:00 [thread overview]
Message-ID: <JM5yyp.Azp@clerew.man.ac.uk> (raw)
In-Reply-To: wccy7gwa7sh.fsf@shell01.TheWorld.com
In <wccy7gwa7sh.fsf@shell01.TheWorld.com> Robert A Duff <bobduff@shell01.TheWorld.com> writes:
>"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> 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
next prev parent reply other threads:[~2007-08-02 20:44 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 [this message]
2007-08-03 7:48 ` Stuart
2007-08-03 7:51 ` Dmitry A. Kazakov
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