Why don't more mainstream statically typed languages support function/method overloading by return type? I can't think of any that do. It seems no less useful or reasonable than supporting overload by parameter type. How come it's so much less popular?
相关问题
- Dynamic Casts or Function Overloads?
- C++ operator lookup misunderstanding
- How to parse nested function calls using Pyparsing
- overloading a float to a numpy array
- Is divide by zero an error or an exception?
相关文章
- Generics and calling overloaded method from differ
- Overloading a super class's function
- Are there any reasons not to use “this” (“Self”, “
- Call/Return feature of classic C++(C with Classes)
- What are the major differences between C and C++ a
- Scala: arrays and type erasure
- Overload resolution with extern “C” linkage
- What set of functions is considered when resolving
Most static languages also now support generics, which would solve your problem. As stated before, without having parameter diffs, there is not way to know which one to call. So if you want to do this, just use generics and call it a day.
For the record, Octave allows different outcome according to return element being scalar vs array.
Cf also Singular Value Decomposition.