The Is Operator

Kyle G. kyle.james.gibson at gmail.com
Tue Oct 2 14:33:25 PDT 2007


Bill Baxter wrote:
> Kyle G. wrote:
>> Hi,
>>
>> First time posting here on the NG, and certainly not my last.
>>
>> D has a good deal of syntactic sugar which results in easier to read 
>> code. However, there's one particular thing that has been bothering me 
>> for a while now:
>>
>> void foo(void[] var) {
>>  if (var !is null)
>>   // line of code
>> }
>>
>> int main() {
>>  foo(null);
>> }
>>
>> 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"?
> 
> Only reason is that it would require adding an extra keyword to the 
> language.
> 
> More annoying to me is that !in doesn't work.
> 
> --bb

Doing !(key in map) definitely causes me distress.




More information about the Digitalmars-d mailing list