If !in is inconsistent because of bool/pointer, then so is !
Rainer Deyke
rainerd at eldwood.com
Fri Feb 6 10:52:01 PST 2009
downs wrote:
> This is NOT a reason against !in. In fact, this so-called
> "inconsistency" is already present in the language. If we remember,
> !pointer already transforms it into a boolean, so it would actually
> be more consistent if !in changed the return type to bool.
I agree. 'a != b' is short for '!(a == b)'. 'a !is b' is short for
'!(a in b)'. For consistency, 'a !in b ' should be short for
'!(a in b)'. I'd even go so far as to say that 'a !+ b' should be short
for '!(a + b)', although I can't think of a use for the '!+' operator.
a !<op> b == !(a <op> b): simple, consistent pattern.
a !<op> b == !(a <op> b), but only for <op> in some limited set that
doesn't include all operators with which you might want to use the
pattern: less consistent; requires memorization.
--
Rainer Deyke - rainerd at eldwood.com
More information about the Digitalmars-d
mailing list