InternetAddress comparison fail

Tobias Pankrath via Digitalmars-d digitalmars-d at puremagic.com
Sat Jan 3 08:42:16 PST 2015


> I can see how the wording is confusing, but that statement is 
> somewhat out of context. What it really means is that == and != 
> *should* be comparing the contents.
>
> It is an explanatory statement as to why you cannot call
>
> obj == null;
>
> Because this translates to obj.opEquals(null), if obj is null, 
> then it crashes (well, at least it used to).
>
> The true definition of the default is here:
>
> https://github.com/schveiguy/druntime/blob/master/src/object_.d#L107
>
> -Steve

Doesn't TDPL talk about that the correct behaviour is this one

https://github.com/schveiguy/druntime/blob/master/src/object_.d#L162

and a == b should be rewritten to opEquals(a, b) which will 
fallback to identity
if a user defined class has no opEquals defined?


Could anyone clarify what the actual and intended behaviour is?



More information about the Digitalmars-d mailing list