Overloading relational operators separately; thoughts?

Minty Fresh via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 29 04:50:15 PDT 2016


On Thursday, 29 September 2016 at 11:29:55 UTC, Russel Winder 
wrote:
> However, this has come up many times, and every time Walter 
> says "no, it's wrong". Whilst the C++ iostreams << may have 
> problems, using this as a single point argument as to why 
> overloading fails in all other cases except numeric arithmetic 
> is bad philosophy. In my view this is holding D back.

To add some thoughts to this,

The use of << being bad is purely a matter of opinion.
If you believe that << is to only be used for bit-shifting 
operations, you might hold the view that it is bad.
On the other hand, if you come from a background like Haskell or 
Ruby, you might have a very different opinion.

ie.
In Ruby, << is named the shovel operator. It's uses are things 
like appending an element into an Array.

Hence, a less opinionated point is necessary here.


More information about the Digitalmars-d mailing list