No household is perfect

Timon Gehr timon.gehr at gmx.ch
Wed Dec 4 12:09:15 PST 2013


On 12/04/2013 06:11 PM, Walter Bright wrote:
> On 12/4/2013 5:50 AM, Jakob Ovrum wrote:
>> The point is that D does not have operator overloading for in-built
>> types. The
>> unnecessary one is the global operator overload you suggest, as it is
>> more
>> intrusive than `opBinaryRight`.
>
> The bad thing about the global operator overloading is that it:
>
> 1. follows different scoping and lookup rules
>
> 2. was the motivation for ADL (aka "Koenig Lookup")
>
> There was no way I was going to put ADL into D :-)

Makes sense, but I'd argue that whenever a.opBinaryRight!"+"(b) is 
valid, then a + b should be valid. (Also, the converse. Built-in types 
do not need to behave specially.)


More information about the Digitalmars-d mailing list