Argumnentation against external function operator overloading is unconvincing

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 23 01:50:56 PDT 2016


On 22.09.2016 10:44, Jonathan M Davis via Digitalmars-d wrote:
> On Thursday, September 22, 2016 00:14:52 H. S. Teoh via Digitalmars-d wrote:
>> Normally this isn't a problem (D's
>> module system will trigger an overload conflict and require explicit FQN
>> to unambiguously select the right overload), but FQN's are not an option
>> when the call is made from generic code.
>
> And in the case of operator overloads, FQN makes no sense at all, since it
> wouldn't be using the operator anymore.
>
> - Jonathan M Davis
>

FQN disables UFCS. Nothing specific to operators here.

There is no reason why there should be any difference between a + b and 
a.opBinary!"+"(b). In fact, 2.opBinary!"+"(3) should work too.


More information about the Digitalmars-d mailing list