specializing generic methods
maurizio.cimadamore at oracle.com
Fri Aug 29 22:40:49 UTC 2014
On 29/08/14 23:11, Dan Smith wrote:
> I'll observe that inference only does two things with an 'any' type variable (I think): i) leave it as a placeholder in a reference type that appears in a bound, and ii) equate it with an ivar. With those constraints, I don't think there's anything you could do to manually specialize a well-typed invocation so that inference would make different choices. Not absolutely sure, but I can't think of anything.
> (Restricting myself to non-overloaded methods, anyway. Start overloading, and of course you can trigger different overload results with specialization.)
this is kinda what I was looking for - I came up with similar examples
as yours in the overloading scenario and primitive conversion - but I
fully agree that we only get one shot at these kind of decisions - and
that is at compile-time. So, I was mainly referring at cases where you
specialize a well-typed invocation and you end up with something bad in
a plain scenario - no overriding, no weird conversions, no 'any'
type-variables bounds. I couldn't find any example that would break - I
was curious if somebody else could think of some - glad that you seem to
confirm this general way of thinking.
More information about the valhalla-dev