Overloading relational operators separately; thoughts?

pineapple via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 29 13:16:00 PDT 2016


On Thursday, 29 September 2016 at 19:39:35 UTC, Jonathan M Davis 
wrote:
> The reality of the matter is that D's operator overloading was 
> designed specifically so that you could overload the built-in 
> operators to be used with your own types so that they could act 
> like the built-in types. It was not intended or designed to 
> allow for the symbols use for those operators to then be used 
> for other arbitrary stuff that's unrelated to what they mean 
> for the built-in types.

I repeat: Your thinking like this limits D's viability for 
real-world code.

Yes, I understand, the reason operator overloading works the way 
it does now is because members of the community wanted to 
arbitrarily limit programmers working in the language. Because 
they believed theirs was the singular appropriate way to use the 
language, to the exclusion of all others.

I'm opinionated too, but I also have the presence of mind to 
recognize that my opinions are not universal, and they are 
certainly no basis for imposing arbitrary limits upon another 
person's behavior.

On Thursday, 29 September 2016 at 19:39:35 UTC, Jonathan M Davis 
wrote:
> And there are plenty of folks who think that overloading 
> operators to do stuff fundamentally different from how they 
> work for the built-in types is bad practice and consider it to 
> be an abuse of operator overloading. So, the fact that D limits 
> that is going to be viewed as positive by many folks.

Let me see if I understand your thinking:

What you're saying is that because some people may not want to 
use a feature in a specific way, D should disallow anyone from 
using the feature in that way? That, somehow, contrary to logic, 
you believe this contributes positively to D's usability and 
appeal?



More information about the Digitalmars-d mailing list