Integrating coercion with subtyping and multiple dispatch

  • Authors:
  • J. J. Hallett;Victor Luchangco;Sukyoung Ryu;Guy L. Steele, Jr.

  • Affiliations:
  • ISO, United States;Sun Microsystems, United States;Sun Microsystems, United States;Sun Microsystems, United States

  • Venue:
  • Science of Computer Programming
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

Coercion can greatly improve the readability of programs, especially in arithmetic expressions. However, coercion interacts with other features of programming languages, particularly subtyping and overloaded functions and operators, in ways that can produce surprising behavior. We study examples of such surprising behavior in existing languages. This study informs the design of the coercion mechanism of Fortress, an object-oriented language with multiple dynamic dispatch, multiple inheritance and user-defined coercion. We describe this design and show how its restrictions on overloaded declarations prevent ambiguous calls due to coercion.