Multiple dispatch in reflective runtime environment

  • Authors:
  • Rajeev Kumar;Vikram Agrawal

  • Affiliations:
  • Department of Computer Science and Engineering, Indian Institute of Technology Kharagpur, Kharagpur, West Bengal 721 302, India;Department of Computer Science and Engineering, Indian Institute of Technology Kharagpur, Kharagpur, West Bengal 721 302, India

  • Venue:
  • Computer Languages, Systems and Structures
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

Message dispatch in object-oriented programming (OOP) involves target method lookup in dispatch table/tree. Reflective environment builds dispatch data-structure at runtime as types can be added at runtime. Hence, algorithms for reflective environments require dynamic data structure for dispatch. In this paper, we propose a tree-based algorithm for multiple dispatch in reflective runtime environment. New classes can be added to the system at runtime. Proposed algorithm performs lookup in time proportional to log(n) times the polymorphic arguments, where n is number of classes in a system. Proposed algorithm uses type-safe approach for multimethod lookup resolving ambiguities. We compare performance of the proposed algorithm with the dispatch mechanism in commonly used virtual/reflexive systems, e.g., Java and Microsoft's Common Language Runtime (MS-CLR), in respect of efficiency and type-safety.