Supporting Explicit Disambiguation of Multi-Methods
Abstract
Multiple inheritance and multiple dispatching are two sources of ambiguities in object-oriented languages. Solving ambiguities can be performed automatical- ly, using techniques such as totally ordering the supertypes of each type or taking the order of the methods' arguments into account. Such implicit disambiguation has the drawback of being difficult to understand by the programmer and hiding programming errors. Conversely, solving ambiguiti- es can be left up to the explicit intervention of the programmer. The most common explicit disambiguation technique consists in defining new methods for ambiguous invocations. However, finding ambiguities and adding as few methods as possible is a difficult task, especially in multi-method systems. In this paper, we show that there always exists a unique minimal set of method redefinitions to explicitly disambiguate a set of multi-methods. We propose an algorithm to compute the minimal disambiguation set, together with {\em ! explanations}: for each method that is to be added, the programmer is given the set of methods that caused the ambiguity.
Domains
Other [cs.OH]
Loading...