Sciweavers

ECOOP
2006
Springer

Variance and Generalized Constraints for C# Generics

14 years 4 months ago
Variance and Generalized Constraints for C# Generics
Abstract. Generic types in C behave invariantly with respect to subtyping. We propose a system of type-safe variance for C that supports the declaration of covariant and contravariant type parameters on generic types. To support more widespread application of variance we also generalize the existing constraint mechanism with arbitrary subtype assertions on classes and methods. This extension is useful even in the absence of variance, and subsumes equational constraints proposed for Generalized Algebraic Data Types (GADTs). We formalize the subtype relation in both declarative and syntax-directed style, and describe and prove the correctness of algorithms for constraint closure and subtyping. Finally, we formalize and prove a type safety theorem for a featherweight language with variant classes and generalized constraints.
Burak Emir, Andrew Kennedy, Claudio V. Russo, Dach
Added 22 Aug 2010
Updated 22 Aug 2010
Type Conference
Year 2006
Where ECOOP
Authors Burak Emir, Andrew Kennedy, Claudio V. Russo, Dachuan Yu
Comments (0)