The Is Operator
Gregor Richards
Richards at codu.org
Tue Oct 2 15:58:52 PDT 2007
0ffh wrote:
> Kyle G. wrote:
>> The code I am concerned about is "var !is null" which appears to
>> translate to "var not is null" when it actually means "var is not
>> null." Is there any special reason why we are unable to do "var isnot
>> null" or "var is not null"?
>
> I think the syntax is perfectly logical, because the negation applies to
> the /operator/ and not the /operand/.Note the analogy of the statements:
>
> (p == null) <--> (p is null)
> (p != null) <--> (p !is null)
>
> Nobody would ever get try to write (i == !null), so why (i is not null)?
>
> Regards, Frank
Yeah, to me "a is not null" makes sense as an English sentence, but as
an operator it seems like "a is (not null)". (not null) would have to
evaluate to ... 1? So this would be a is 1, which isn't what we want at all.
Suffice to say D !is English.
- Gregor Richards
More information about the Digitalmars-d
mailing list