Overloading relational operators separately; thoughts?

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 29 18:15:31 PDT 2016


On Thu, 29 Sep 2016 10:41:38 +0200, Timon Gehr wrote:

> On 29.09.2016 06:15, Walter Bright wrote:
>> On 9/28/2016 1:40 PM, Timon Gehr wrote:
>>> (This is NOT expression templates.)
>>
>> Right, but it's an enabler of expression templates. Discussion of more
>> powerful operator overloading cannot be divorced from expression
>> templates, and once ETs are in we'll be stuck with them forever.
>> ...
> 
> They work today, just not with comparison operators.

To take it the other way, D could enforce that the return type of 
arithmetic operators is compatible with at least one of the operands -- 
by implicit cast or constructor or being the same type. Wouldn't that be 
fun?


More information about the Digitalmars-d mailing list