Type-Safe Compilation of Covariant Specialization: A Practical Case

Abstract

Despite its lack of type safety, some typed object-oriented languages use covariant specialization for methods. In this work, we show how one may modify the semantics of languages that use covariant specialization in order to improve their type safety. We demonstrate our technique using O2, a strongly and statically typed object-oriented database programming language which uses covariant specialization. We propose a modification to the O2 compiler that adds code to correct previously ill-typed computations that arise from the use of covariant specialization. The modification we propose does not affect the semantics of those computations without type errors. Furthermore, the new semantics of the previously ill-typed computations is defined in a very "natural" way and ensures the type safety (w.r.t. covariance) of the program. Since the solution consists of a conservative backward-compatible modification of the compiler, it does not require, unlike other solutions, any modification of existing O2 code. Our solution is based solely on a type-theoretic analysis and thus is general. Therefore, although this paper applies it to a particular programming language, the same ideas could easily be applied to other languages that uses covariant specialization.

Open PDF

Document Details

Document Type
Technical Report
Publication Date
Nov 01, 1995
Accession Number
ADA605048

Entities

People

  • Giuseppe Castagna
  • John Boyland

Organizations

  • University of California, Berkeley

Tags

Communities of Interest

  • C4I

DTIC Thesaurus Topics

  • Algorithms
  • Compilers
  • Computations
  • Computer Languages
  • Computer Programming
  • Computer Programs
  • Computer Science
  • Computers
  • Databases
  • Language
  • Linguistics
  • Lisp Programming Language
  • Object Oriented Programming
  • Programming Languages
  • Semantics
  • Simulations
  • Theoretical Computer Science

Fields of Study

  • Computer science

Readers

  • Computational Linguistics
  • Finite Element Method (FEM) for solving Partial Differential Equations (PDEs)