On Thursday, 19 December 2024 at 18:49:28 UTC, sfp wrote:
Subject lines says it all, I think... The choice to make binary
operators implementable only via this `opBinary` template means
it's unclear how to get virtual operators on an interface.
E.g., this toy example *does* compile:
```
interface Scalar {
Scalar opBinary(string op)(Scalar rhs); // wrong
}
[...]
Function templates declared in interfaces are not virtual, see
https://dlang.org/spec/interface.html#method-bodies (§17.1.1.2),
so as `Scalar.opBinary` has no body the linker cannot find the
matching function.