3 ms·
It is also interesting to note that this behavior of '+' in C an C++ and Java is basically (logically) multiple-dispatch on the types of its arguments, but the
by lurker19 15y ago
It is also interesting to note that this behavior of '+' in C an C++ and Java is basically (logically) multiple-dispatch on the types of its arguments, but the language does not allow programmers to define operators like this -- C does not allow user-defined operators at all, in C++ you have to define the operator in every class that can appear on the left-hand-side, in Java you can define a method which looks almost like an operator but still has to be smeared across all classes (unless you write a utility class method Foo.plus(A, B) that eliminates the asymmetry between the two operands).
This subordination of functions below objects, and special reservation of rights for builtins, is what functional programming language uses loath about non-FP languages.