www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - foo == null should be a compile-time error

reply Piotr Fusik <Piotr_member pathlink.com> writes:
Someone here argued that foo.opEquals(null) could return a sensible value.
I cannot agree with that, since people expect that a==b iff b==a.
null == foo never returns true or false, so foo == null shouldn't either.
The same applies to foo != null.
May 18 2005
parent reply "Ben Hinkle" <ben.hinkle gmail.com> writes:
"Piotr Fusik" <Piotr_member pathlink.com> wrote in message 
news:d6f4j7$1udh$1 digitaldaemon.com...
 Someone here argued that foo.opEquals(null) could return a sensible value.
 I cannot agree with that, since people expect that a==b iff b==a.
 null == foo never returns true or false, so foo == null shouldn't either.
 The same applies to foo != null.
In case you weren't aware, this topic has come up a few times recently - I think Kris's thread kicked off lots of discussion about it.
May 18 2005
parent reply Piotr Fusik <Piotr_member pathlink.com> writes:
In case you weren't aware, this topic has come up a few times recently - I 
think Kris's thread kicked off lots of discussion about it. 
I don't feel enough patient to read that thread. Could you please tell me what's the final conclusion?
May 20 2005
parent "Ben Hinkle" <ben.hinkle gmail.com> writes:
"Piotr Fusik" <Piotr_member pathlink.com> wrote in message 
news:d6kaeb$jqe$1 digitaldaemon.com...
In case you weren't aware, this topic has come up a few times recently - 
I
think Kris's thread kicked off lots of discussion about it.
I don't feel enough patient to read that thread. Could you please tell me what's the final conclusion?
I lost track of it fairly quickly I'm afraid... but then I came to accept foo==null behavior a while ago so the topic didn't hold my interest. The archives have more discussions about ==null so that latest thread might not be the best place to start. Basically some people think it should be an error, some people don't. discuss... (or not...)
May 20 2005