On Monday, 20 May 2013 at 19:26:28 UTC, Maxim Fomin wrote:
On Monday, 20 May 2013 at 15:15:33 UTC, John Colvin wrote:
struct S {
auto opDispatch(string s)(A i){}
}
struct A {}
void main() {
S s;
A a;
s + a; //Error: incompatible types for ((s) + (a)): 'S' and
'A'
}
It would be really nice if opDispatch could catch missing
operator overloads.
This would also leads to bugs when invalid code is silently
accepted in each user-defined type where opDispatch is defined.
Could you please expand on why / give an example?
Seeing as all operators (only on user defined types, sadly) can
be rewritten as op***** member functions, I don't see why having
opDispatch catch missing operators is any different from it
catching missing member function calls, as it currently does.