The Is Operator

0ffh spam at frankhirsch.net
Tue Oct 2 15:19:35 PDT 2007


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



More information about the Digitalmars-d mailing list