Overloading relational operators separately; thoughts?

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 30 12:02:41 PDT 2016


On 30.09.2016 03:15, Chris Wright wrote:
> 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.


It wouldn't infer with any of my use cases, but I don't see the point.

> Wouldn't that be fun?
>

Certainly.


More information about the Digitalmars-d mailing list