WG211/M12Smaragdakis
Forsaking Inheritance: Supercharged Delegation as a Modular OO Primitive by Yannis Smaragdakis
We propose an OO language design that eschews inheritance completely, in favor of a combination of class morphing and (deep) delegation. Compared to past delegation approaches, the novel aspect of our design is the ability to emulate the best aspects of inheritance while retaining maximum flexibility: using morphing, a class can select any of the methods of its delegatee and export them (if desired) or transform them (e.g., to add extra arguments or modify type signatures), yet without needing to name these methods explicitly and handle them one-by-one. Compared to past work on morphing, our approach adopts and adapts advanced delegation mechanisms, in order to add late binding capabilities and, thus, provide a full substitute of inheritance. Additionally, our work replaces several common uses of aspect-oriented constructs, yet with strong type safety guarantees.