minimal evaluation

downs default_357-line at yahoo.de
Tue Apr 7 03:08:45 PDT 2009


TomD wrote:
> Qian Xu Wrote:
> 
>> Hi All,
>>
>> Is minimal evaluation always enabled in D?
>>
>> I want to write a function IsNull(), so that I can check the precondition as
>> follows:
>>
>> Â  if (isNull(foo) ||
>> Â  Â  Â  isNull(foo.getBar) ||
>> Â  Â  Â  isNull(foo.getBar.getBar2)
>> Â  {
>> Â  Â  return false;
>> Â  }
>> Â  // normal code goes here
>>
>> If an argument is null, the IsNull() will return false. Internally it will
>> be logged to console as well.
> Make it return true then. An "or" is true when it hits the first
> true expression. 
> 

 .. Wait. Did I just read that right - when an argument is null, isNull returns *false*?

What the hell?

> Ciao
> TomD



More information about the Digitalmars-d mailing list