If !in is inconsistent because of bool/pointer, then so is !

Rainer Deyke rainerd at eldwood.com
Fri Feb 6 15:39:33 PST 2009


downs wrote:
> A large part of the case for !in is that you can pronounce it "a *not
> in* b". !+, on the other hand, would be .. what? "a not plus b? does
> that mean a - b? " :)

It's a question of consistent patterns versus special cases.  If
'a !<op> b == !(a <op> b)', then the parser can rewrite all 'a !<op> b'
expressions as '!(a <op> b)' in a single place, without looking at what
<op> is.

(Of course '!=' (as the opposite of '==' as opposed to '=') is already a
special case, so perhaps defining the '!<op>' operators individually is
unavoidable.  'a !== b' as '!(a == b)' would work, but 'a != b' as '!(a
= b)' would be very weird and inconsistent with other languages.)

I'm not suggesting that anybody should actually /use/ the '!+' operator,
even if it was defined.  That would be horrible.


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list