Affiliation:
1. University of Genoa, Italy
Abstract
Semantic subtyping is an approach for defining sound and complete procedures to decide subtyping for expressive types, including union and intersection types; although it has been exploited especially in functional languages for XML based programming, recently it has been partially investigated in the context of object-oriented languages, and a sound and complete subtyping algorithm has been proposed for record types, but restricted to immutable fields, with union and recursive types interpreted coinductively to support cyclic objects. In this work we address the problem of studying semantic subtyping for imperative object-oriented languages, where fields can be mutable; in particular, we add read/write field annotations to record types, and, besides union, we consider intersection types as well, while maintaining coinductive interpretation of recursive types. In this way, we get a richer notion of type with a flexible subtyping relation, able to express a variety of type invariants useful for enforcing static guarantees for mutable objects. The addition of these features radically changes the defi- nition of subtyping, and, hence, the corresponding decision procedure, and surprisingly invalidates some subtyping laws that hold in the functional setting. We propose an intuitive model where mutable record val- ues contain type information to specify the values that can be correctly stored in fields. Such a model, and the correspond- ing subtyping rules, require particular care to avoid circularity between coinductive judgments and their negations which, by duality, have to be interpreted inductively. A sound and complete subtyping algorithm is provided, together with a prototype implementation.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
7 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. A Subtyping Scheme for Nominal and Structural Types Based on Class Graph Equivalence;2021 4th International Conference on Blockchain Technology and Applications;2021-12-17
2. RML: Theory and practice of a domain specific language for runtime verification;Science of Computer Programming;2021-05
3. Can determinism and compositionality coexist in RML?;Electronic Proceedings in Theoretical Computer Science;2020-08-27
4. Decidable tag-based semantic subtyping for nominal types, tuples, and unions;Proceedings of the 21st Workshop on Formal Techniques for Java-like Programs - FTfJP '19;2019
5. Empowering union and intersection types with integrated subtyping;Proceedings of the ACM on Programming Languages;2018-10-24