Re:Impossible Java
by masklinn on Wednesday March 29, 2017 @03:40AM
(#13984177)
> here's the edge case though.
That's no more an edge case than the cases where you throw away the return value or you're binding to an ambiguous type e.g. `A getFoo()`, `B getFoo()`, `Object foo = getFoo()`.
> The more I think about this the more I wonder why this isn't possible.
The Java spec does not say, for C++ Stroustrup states it's
> to keep resolution for an individual operator or function call context-independent.
the Java reason is likely also some sort of Principle of Least Surprise claim.
That's no more an edge case than the cases where you throw away the return value or you're binding to an ambiguous type e.g. `A getFoo()`, `B getFoo()`, `Object foo = getFoo()`.
> The more I think about this the more I wonder why this isn't possible.
The Java spec does not say, for C++ Stroustrup states it's
> to keep resolution for an individual operator or function call context-independent.
the Java reason is likely also some sort of Principle of Least Surprise claim.