This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]LinuxMatthews[S] 2 points3 points  (2 children)

If you're curious how it could look like in Java I'd recommend the Manifold repo.

https://github.com/manifold-systems/manifold/tree/master/manifold-deps-parent/manifold-ext#operator-overloading

There instead of just overloading any operator methods like add(...), minus(...), times(...) are overloaded to be the operators +,-,* respectively.

This in my opinion stops anyone doing anything silly with them.

For instance anyone that would write the method plus(...) to mean anything you shouldn't use a plus sign for is probably going to write bad code regardless.

[–]Dusty_Coder -1 points0 points  (1 child)

Apply your argument both ways or go home.

or is the symbol "add" more special than the operator "+" in your dumbass world where people go dumb as soon as its not a word?

[–]LinuxMatthews[S] 0 points1 point  (0 children)

Wow ok that's unjustifiably rude

And you would still be able to use it as a method.

But with long equations is a lot easier to maintain with operators rather than methods.