On Thursday, 7 May 2015 at 14:37:14 UTC, Manfred Nowak wrote:
According to the specs
  http://dlang.org/operatoroverloading.html#equals
`object.opEquals' denies to call the `opEquals'-function tailored for the class of two objects `a' an `b' if for those objects `a is b' holds.

Although this seems resonable and reduces boiler-plate it makes it impossible to implement a side-effect for those cases.

I do not believe, that there is good reason to disallow side-effects in those cases. Therefore a mechanism to enable such side-effects should be implemented.

-manfred

Having the base Object method check for 'is' itself results in not having to make a virtual call in, I would guess, about 40-50% of cases or even more. It's a performance benefit.

Reply via email to