On 21.09.2016 21:01, Timon Gehr wrote:
On 21.09.2016 19:57, HaraldZealot wrote:
So if someone has real rationale not to have operator overloading as
external function I'm curios to arguments.
[1] http://dlang.org/rationale.html
There is no technical reason that would make the implementation of this
feature difficult, if that is your question.
Basically, the rationale is: external operators cannot be used in
generic code that does not import the module defining the operators. C++
works around this using ADL. Walter (justifiably) does not like ADL,
hence the limitation.
(I don't agree with that line of reasoning: obviously this is not only
an issue for operators, but for any UFCS function; operators are mere
syntactic sugar.)
BTW, another argument in favour of free function operators is opOpAssign
for classes.