A Flow-Based Approach for Variant Parametric Types
|
Abstract: |
|
A promising approach for type-safe generic codes in the objectoriented 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.
|
|
Paper: |
|
Wei-Ngan Chin, Florin Craciun, Siau-Cheng Khoo, Corneliu Popeea -
A Flow-Based Approach for Variant Parametric Types.
ACM OOPSLA 2006, Portland, October 2006
|