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

Moritz Warning moritzwarning at web.de
Fri Feb 6 07:42:28 PST 2009


On Fri, 06 Feb 2009 12:42:30 +0100, downs wrote:

> This has been brought up before as an argument against the !in operator
> (forcing us to resort to such workarounds as /notin/): that the !in
> operator would have inconsistent syntax with in, because in returns a
> pointer and !in would return a bool.
> 
> 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.
> 
> Furthermore, many newcomers expect !in to work because it is intuitive.
> Violating such user expectations should be avoided wherever possible.

Having such operator/syntactic sugar would be very nice.
None of the arguments against it have convinced me so far.



More information about the Digitalmars-d mailing list