[Issue 8062] UFCS and operator overloading
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 7 21:34:54 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=8062
--- Comment #8 from jens.k.mueller at gmx.de ---
I think my reasoning back then (almost seven years ago) was that operator
overloading just rewrites one syntax into another. In the specific case a + b
-> a.opBinary!("+")(b). I thought about this as a purely syntactical lowering
which seems to be wrong. Because the compiler seems to actually check whether
the template member function actually exists. That's why the chain seems to
stop there and UFCS is not performed. Thanks for the clarification.
Back then it was interesting to me as it would have allowed me to implement
operators via free functions which I would have liked. I could have even placed
them in a different module. Not that you cannot get a similar behavior by
passing template arguments but this seemed more involved.
--
More information about the Digitalmars-d-bugs
mailing list