Behavior of opEquals

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 7 03:26:00 PDT 2015


On 09/05/2015 08:18 AM, Jonathan M Davis wrote:
> On Friday, 4 September 2015 at 20:39:14 UTC, Timon Gehr wrote:
>> On 09/04/2015 09:21 PM, H. S. Teoh via Digitalmars-d wrote:
>>>
>>> Wait, wait, did I miss something? Since when was operator overloading
>>> allowed as free functions?
>>
>> Since UFCS, but DMD does not implement it.
>
> There is nothing in the spec about supporting operator overloading with
> free functions, so I don't know where you get the idea that it's even
> intended to be a feature. UFCS applies to functions which use the member
> function call syntax, and operators aren't used that way.

Specifying semantics via lowering is somewhat pointless if rewrites are 
not transitive.

> There is no plan whatsoever to support operator overloading via free functions.
> ...

Then specify operator overloading using __traits(getMember,...). (I 
consider this unwise though.)


More information about the Digitalmars-d mailing list