A flow-based approach for variant parametric types

  • Authors:
  • Wei-Ngan Chin;Florin Craciun;Siau-Cheng Khoo;Corneliu Popeea

  • Affiliations:
  • National University of Singapore;National University of Singapore;National University of Singapore;National University of Singapore

  • Venue:
  • Proceedings of the 21st annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

Abstract

A promising approach for type-safe generic codes in the object-oriented paradigm is variant parametric type, which allows covariant and contravariant subtyping on fields where appropriate. Previous approaches formalise variant type as a special case of the existential type system. In this paper, we present a new framework based on flow analysis and modular type checking to provide a simple but accurate model for capturing generic types. Our scheme stands to benefit from past (and future) advances in flow analysis and subtyping constraints. Furthermore, it fully supports casting for variant types with a special reflection mechanism, called cast capture, to handle objects with unknown types. We have built a constraint-based type checker and have proven its soundness. We have also successfully annotated a suite of Java libraries and client code with our flow-based variant type system.