Overloading relational operators separately; thoughts?
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Thu Sep 29 01:41:38 PDT 2016
On 29.09.2016 06:15, Walter Bright wrote:
> On 9/28/2016 1:40 PM, Timon Gehr wrote:
>> What's wrong with that usage?
>
> Because then something other than comparison is happening with <=,
You also complained about '+'.
> <, >,
>>= and there'll be nothing in the code to give the user a hint.
> ...
Actually, comparison is precisely what is happening. The hint about what
is happening precisely is that the entire codebase does symbolic
computations all over the place, and it is very clear what the involved
types are.
>
>> (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.
>
> D has many very powerful modeling abilities, but so far we've tried to
> stay away from things that make context-free user understanding of code
> unduly difficult. It should not be necessary to use an IDE to understand
> code.
> ...
That is and has always been the responsibility of the programmer. (IDEs
don't even help that much.)
> In that category are things like text macros, AST macros, user-defined
> syntax, non-arithmetic operator overloading, and expression templates.
What's the definition of "arithmetic" here?
More information about the Digitalmars-d
mailing list