But the compiler doesn't know that, unless perhaps foo has an explicit
interface. And even with an explicit interface, having the compiler
deduce the type of the actual argument would violate the almost
universal principle of expression evaluation not being influenced by
context. The exceptions to that principle are, well, exceptional. It
would also cause circularity problems if foo were generic - deducing the
type of the actual based on the type of the dummy, but having the
specific procedure (and thus the type of the dummy) depend on the type
of the actual.
Of course, if type parameters for different types were guaranteed to be
disjoint, which I'd have liked, things might work better, but I'm afraid
it's a bit late for that.
--
Richard Maine
email: last name at domain . net
domain: summer-triangle