A Flow-Based Approach for Variant Parametric Types |
A Flow-Based Approach for Variant Parametric TypesResearch Paper Thursday, Oct 26, from 10:30 to 12:00
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. Wei-Ngan Chin, Department of Computer Science, National University of Singapore Florin Craciun, Department of Computer Science, National University of Singapore Siau-Cheng Khoo, Department of Computer Science, National University of Singapore Corneliu Popeea, Department of Computer Science, National University of Singapore
|