Wrong selection of opEquals for objects.
Simen Kjærås
simen.kjaras at gmail.com
Fri Aug 28 13:51:05 UTC 2020
On Friday, 28 August 2020 at 13:35:43 UTC, Alexandru Ermicioi
wrote:
> On Friday, 28 August 2020 at 12:29:20 UTC, Simen Kjærås wrote:
>> ....
>
> Seems that these methods should be rooted out from Object, and
> placed in respective interfaces like:
>
> -----
> interface Equatable(T) {
> bool opEquals(T value);
> }
> -----
>
> Then it would be a lot more simple. People who want equality
> check, will implement interface with right type, for example
> Equatable!Object.
Yup, it's been proposed, but nothing's come of it yet. Here's
Andrei's DIP on ProtoObject, which apparently is untouched for
over two years now:
https://github.com/andralex/DIPs/blob/ProtoObject/DIPs/DIPxxxx.md
The main problem with solving this issue is doing so will break
all code that uses the current system. This is clearly suboptimal.
--
Simen
More information about the Digitalmars-d-learn
mailing list