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

downs default_357-line at yahoo.de
Fri Feb 6 03:42:30 PST 2009


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.



More information about the Digitalmars-d mailing list