[Paper Review] Multimethods and separate static typechecking in a language with C++-like object model
This paper presents OOLANG, a C++-like, pointer-free, class-based language that supports multimethods with separate static typechecking and efficient link-time verification. It introduces a two-phase typechecking system—compile-time for individual modules and lightweight link-time checks using compressed dispatch tables—while solving object realignment challenges in multiple inheritance through runtime type tables and offset computation.
The goal of this paper is the description and analysis of multimethod implementation in a new object-oriented, class-based programming language called OOLANG. The implementation of the multimethod typecheck and selection, deeply analyzed in the paper, is performed in two phases in order to allow static typechecking and separate compilation of modules. The first phase is performed at compile time, while the second is executed at link time and does not require the modules' source code. OOLANG has syntax similar to C++; the main differences are the absence of pointers and the realization of polymorphism through subsumption. It adopts the C++ object model and supports multiple inheritance as well as virtual base classes. For this reason, it has been necessary to define techniques for realigning argument and return value addresses when performing multimethod invocations.
Motivation & Objective
- To enable static, separate compilation of multimethods in a C++-like object-oriented language with multiple inheritance.
- To solve the challenge of type inconsistency between separately compiled modules when linking multimethods.
- To support efficient runtime dispatch for multimethods without pointers, using subsumption and virtual functions.
- To address object realignment issues arising from multiple inheritance when passing or returning objects across type boundaries.
- To provide a practical, performant implementation of multimethods in a language targeting mathematical and high-performance computing.
Proposed method
- Proposes a two-phase typechecking system: compile-time typechecking per module and a lightweight link-time check during compressed dispatch table construction.
- Uses a runtime type table (RTTABLE) to store parent class offsets, enabling dynamic realignment of objects to their expected subobject representations.
- Employs a parameter passing scheme requiring coordination between caller and callee to handle value, reference, and const parameter passing with multimethod dispatch.
- Introduces a realignment mechanism that computes the address of a target parent subobject within a derived object using parent offset information from RTTABLE.
- Supports polymorphism via subsumption, allowing derived class instances to be used where base class types are expected, even in multimethod contexts.
- Designs a dispatch mechanism that integrates link-time checks into the compressed dispatch table generation, ensuring type safety without requiring whole-program analysis.
Experimental results
Research questions
- RQ1How can multimethods be typechecked statically and separately across modules in a C++-like object model with multiple inheritance?
- RQ2What mechanisms are required to ensure type safety when linking separately compiled modules containing multimethods?
- RQ3How can object addresses be realigned at runtime when passing or returning objects across multiple inheritance hierarchies?
- RQ4What is the performance impact of integrating link-time checks into dispatch table construction?
- RQ5How can parameter passing semantics (value, reference, const) be safely coordinated with multimethod dispatch in a pointer-free language?
Key findings
- The two-phase typechecking approach enables full static typechecking of multimethods in separately compiled modules without requiring whole-program analysis.
- Link-time checks are efficiently integrated into the compressed dispatch table construction process, ensuring type safety with minimal overhead.
- Object realignment is achieved using a runtime type table (RTTABLE) that stores parent class offsets, allowing correct subobject addressing during method calls and returns.
- The system successfully handles complex cases involving multiple inheritance and const parameters without breaking type safety.
- The approach supports polymorphism via subsumption and maintains compatibility with C++-like object layout and virtual function semantics.
- The implementation demonstrates that efficient, safe, and modular multimethods are feasible in a pointer-free, statically typed, class-based language.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.