4 research outputs found
Attaining multiple dispatch in widespread object-oriented languages
Multiple dispatch allows determining the actual method to be executed, depending on the dynamic types of its arguments. Although some programming languages provide multiple dispatch, most widespread object-oriented languages lack this feature. Therefore, different implementation techniques are commonly used to obtain multiple dispatch in these languages. We evaluate the existing approaches, presenting a new one based on hybrid dynamic and static typing. A qualitative evaluation is presented, considering factors such as software maintainability and readability, code size, parameter generalization, and compile-time type checking. We also perform a quantitative assessment of runtime performance and memory consumption
A Reflective Implementation of Java Multi-Methods
International audienceIn Java, method implementations are chosen at runtime by late-binding with respect to the runtime class of just the receiver argument. However, in order to simplify many programming designs, late-binding with respect to the dynamic type of all arguments is sometimes desirable. This behavior, usually provided by multi-methods, is known as multi-polymorphism. This paper presents a new multi-method implementation based on the standard Java re flection mechanism. Provided as a package, it does not require any language extension nor any virtual machine modi cation. The design issues of this refl ective implementation are presented together with a new and simple multi-method dispatch algorithm that effi ciently supports class loading at runtime. This implementation provides a practicable and fully portable multi-method solution