Overloading relational operators separately; thoughts?

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 28 07:27:58 PDT 2016


On Tue, 27 Sep 2016 23:05:54 -0700, Jonathan M Davis via Digitalmars-d
wrote:

> On Wednesday, September 28, 2016 03:28:50 Minty Fresh via Digitalmars-d
> wrote:
>> Lastly, if operators are intended to behave so strictly, why does this
>> not extend then to binary arithmetic operators (+, -, *, /, %, etc.)
>> They don't follow the same rules as the binary relational operators,
>> after all.
> 
> It's not possible in the general case to define the arithmetic operators
> as functions of each other. They actually need to be defined separately
> in order to work.

Specifically for making efficient programs. Increment, decrement, and 
test for equality is sufficient mathematically, but we want programs that 
terminate in our lifetimes.
</pedantry>


More information about the Digitalmars-d mailing list