This paper proposes an extension of the notion of method as it is currently used in most object-oriented languages. We define polymethods as methods that we-can attach directly to types, as opposed to classes and that we can describe with a second-order type. Two benefits result from this extension; first, the expressive power of the language is improved with better modeling abilities. Next, second-order types yield a more powerful (precise) type inference, which extends the range of static type checking in a truly extensible object-oriented language. We first show that extensible object-oriented languages present many difficulties for static type-checking and that second-order types are necessary to get stronger type-checking. We illustrate how to combine polymethods through type inheritance and propose a technique based on abstract interpretation to derive a second-order type for new polymethods.
展开▼