Making `object.opEquals' replaceable
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Thu May 7 17:24:21 PDT 2015
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.
And why not just use another function instead of opEquals for
what you want?
- Jonathan M Davis
More information about the Digitalmars-d
mailing list