News for hackers. Stuff that matters.
Re:Why bad scientific code beats code following "best practi... by Nursie on Saturday January 06, 2024 @05:50AM (#38890331)
Operator overloading leads to less readable, maintainable code IMHO, because you have to go off and figure out if the operator means a special thing in a given context.

Certainly adds to complexity in C++.

Re:Why bad scientific code beats code following "best practi... by chongli on Saturday January 06, 2024 @06:04AM (#38890401)
It works well when you stick to math and follow mathematical laws. Overloading the addition operator to allow you to add two vectors is great, as long as you make sure you don’t break the laws of vector addition in your vector space.

Overloading addition to mean something else entirely? That’s a problem!

It would be great if type systems could allow us to set up these laws and enforce them at compile time, but then you go down the whole rabbit hole of automated theorem proving.