Interface-Scoped Dispatch: General Delegation with O(1) Self-Calls
Abstract
The conceptual appeal of object composition lies in its ability to build loosely coupled systems from independent runtime components. Yet conventional object composition lacks late-bound self-calls, or open recursion, a defining strength of implementation inheritance. Restoring open recursion while retaining the properties of object composition remains an unmet challenge. We present Parts, a general delegation model that unifies independent runtime components, arbitrary composition, and open recursion. Its enabling mechanism, interface-scoped dispatch (ISD), assigns composite identity per interface at construction, allowing self-calls to dynamically dispatch through overriding composites. Parts is realized as a compiler plugin for Java 8-27 with IDE integration. It achieves O(1) dispatch cost that is empirically equivalent to a standard vtable call, providing open recursion through composition without sacrificing the independence and flexibility that make object composition attractive.
// Source
Authors: Robert Scott McKinney