Overloading relational operators separately; thoughts?
pineapple via Digitalmars-d
digitalmars-d at puremagic.com
Fri Sep 30 12:33:33 PDT 2016
On Friday, 30 September 2016 at 16:25:45 UTC, Jonathan M Davis
wrote:
> But if you or anyone else wants to do wacky stuff with
> overloaded operators that is not consistent with the built-in
> types, you're free to do so within how D's overloaded operators
> work. You're just not going to be able to do it as freely as
> you can in C++, because that goes against the goals of the
> operator overloading feature in D, and some of the improvements
> that were in line with the goals happen to have gotten in the
> way of such operator overloading abuse.
In your arguments in favor of this limitation of operator
overloading, you keep referring to these goals, of what operator
overloads have been intended to do. You've stated and restated
that same explanation even though it's completely unconvincing
because while stating this intention you have failed entirely to
justify it.
How many people have to state it how many times in how many
different ways before it gets through? These are stupid goals.
They reflect intention that has no basis in reason, that has no
basis in reality, that is a blindly-enforced dogma.
It always would have been simpler if, in the first place,
opBinary had caught comparison operators and opCmp and opEquals
were omitted. Instead, those making the decisions went out of
their way to impose these arbitrary limitations. If we can start
now to untangle that mistake, it will make D more tenable for
real-world code.
And make no mistake: Perl is fantastic for real-world code
because real-world code is not elegant, and it doesn't follow the
rules, and it doesn't care how you meant for a feature to be
used. Practical languages give the programmer a great deal of
expressive power, and it's okay if the rules allow nonsense
expressions because it's up to the programmer, not the language,
to know what's nonsense and what's not.
More information about the Digitalmars-d
mailing list