Argumnentation against external function operator overloading is unconvincing
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Wed Sep 21 12:19:55 PDT 2016
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.
>>  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
More information about the Digitalmars-d