Yes, allowing overloading on return types complicates a language. It complicates the resolving of overloaded identifiers (e.g. function names). But it isn't impossible, e.g. Haskell allows to overload function based on their return type.
class Num a where
fromInteger :: Integer -> a
...
Num
is a type class in Haskell with a method called fromInteger
which is a function from an arbitrary size Integer
to an arbitrary type which has an instance of Num
. The Haskell type class mechanism is rather different from the class concept of object-oriented languages. Therefore my explanation might sound strange.
But, the result is I can use the function fromInteger and, depending on the calling context, different implementations are chooen at compile time.
There is a whole line of research on type systems, which made this feature possible. Therefore, I'd say it is doable in statically typed languages. Dynamically typed languages would either require time-travelling or some clever ideas.