Re: opEquals optimized away?

2015-05-05 Thread Manfred Nowak via Digitalmars-d-learn
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

Re: opEquals optimized away?

2015-05-05 Thread Ali Çehreli via Digitalmars-d-learn
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

opEquals optimized away?

2015-05-04 Thread Manfred Nowak via Digitalmars-d-learn
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

Re: opEquals optimized away?

2015-05-04 Thread anonymous via Digitalmars-d-learn
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`