On Tuesday, 5 May 2015 at 05:26:17 UTC, anonymous wrote:
because `c is c`
Thanks. One can see this documented in
http://dlang.org/operatoroverloading.html#equals
But
1: how can one override this behavior
2: what is the design reason for this
Especially: how can one implement side effects
On 05/05/2015 04:30 PM, Manfred Nowak wrote:
On Tuesday, 5 May 2015 at 05:26:17 UTC, anonymous wrote:
because `c is c`
Thanks. One can see this documented in
http://dlang.org/operatoroverloading.html#equals
But
1: how can one override this behavior
There is now way in D other than
class C{
override bool opEquals( Object o){
return true;
}
}
unittest{
auto c= new C;
assert( c == c);
}
`rdmd --main -unittest -cov' shows, that opEquals is not
executed. Why?
-manfred
On Tuesday, 5 May 2015 at 04:09:03 UTC, Manfred Nowak wrote:
class C{
override bool opEquals( Object o){
return true;
}
}
unittest{
auto c= new C;
assert( c == c);
}
`rdmd --main -unittest -cov' shows, that opEquals is not
executed. Why?
-manfred
because `c is c`