Discussion Thread: DIP 1042--ProtoObject--Community Review Round 1

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Fri Jan 14 22:45:53 UTC 2022


On Friday, 14 January 2022 at 16:00:49 UTC, Adam D Ruppe wrote:
>
> The interfaces, as defined, are utterly useless anyway and will 
> probably never be used but yeah interesting find.

Imho interfaces could be smth like this:

```d
interface Equals(U) {
   bool equals(U other);

   bool opEquals(this T)(U other) {
     return (cast(T) this).equals(other);
   }
}
```

In this case you can narrow down by attributes the equals 
implementation, and the opEquals will pick them, given T is known 
at compile time (i.e. the implementor/extender of interface).

Best regards,
Alexandru.


More information about the Digitalmars-d mailing list