# Constrained matching is type safe

## Abstract

Temporally constrained matching in a persistent and declarative object-oriented system is introduced as a semantic alternative to the existing approaches to the covariance/contravariance problem. While the existing object-oriented type systems are based on subtyping, F-bounded polymorphism and matching, this language system is based entirely on inheritance, which is identified with matching. The type of matching used in this paper relies on the temporal constraint system. We prove that this constrained matching guarantees type safe substitutability even in situations where matching alone would not. This is possible only because the underlying formal system is semantically much richer than the paradigms of type systems. Its temporal constraint system can capture subtleties that go far beyond the level of expressiveness of object-oriented type systems. The temporal nature of the language and its distinctive orthogonal model of persistence make this language system successful in handling a variety of non-trivial applications.

## Keywords

Type systems declarative programming temporal logic constraints persistence## Preview

Unable to display preview. Download preview PDF.

## References

- [AM87]M. Abadi and Z. Manna, Temporal Logic Programming, Proceedings of Symposium on Logic Programming, IEEE Computer Society Press, pp. 4–16, 1987.Google Scholar
- [AC96]M. Abadi and L. Cardelli, On Subtyping and Matching, Proceedings of ECOOP'96,
*Lecture Notes in Computer Science*, Springer-Verlag, Vol. 1098, pp. 145–167, 1996.Google Scholar - [Ala97a]S. Alagić, A Temporal Constraint System for Object-Oriented Databases, Constraint Databases and Applications, Proceedings of CDB'97 and CP'96 Workshops,
*Lecture Notes in Computer Science*Vol. 1191, pp. 208–218, Springer-Verlag, 1997.Google Scholar - [Ala97b]S. Alagić, The ODMG Object Model: Does it Make Sense? Proceedings of the OOPSLA '97 Conference, pp. 253–270, ACM, 1997.Google Scholar
- [AA97]S. Alagić, M. Alagić, Order-Sorted Model Theory for Temporal Executable Specifications,
*Theoretical Computer Science 179*, pp. 273–299, 1997.Google Scholar - [Ala95]S. Alagić, A Statically Typed, Temporal Object-Oriented Database Technology,
*Transactions on Information and Systems*, IEICE, Vol. 78, pp. 1469–1476, 1995.Google Scholar - [ASB94]S. Alagić, R. Sunderraman and R. Bagai, Declarative Object-Oriented Programming: Inheritance, Subtyping and Prototyping, Proceedings of ECOOP '94,
*Lecture Notes in Computer Science*Vol. 821, pp. 236–259, 1994.Google Scholar - [Ala94]S. Alagić,F-bounded Polymorphism for Database Programming Languages, Proceedings of the 2nd East-West Database Workshop, Workshops in Computing, pp. 125-137, Springer-Verlag, 1994.Google Scholar
- [AM95]M. Atkinson and R. Morrison, Orthogonally Persistent Object Systems,
*VLDB Journal*, 4, pp. 319–401, (1995).Google Scholar - [BDK92]F. Bancilhon, C. Delobel and P. Kanelakis (eds),
*Implementing an ObjectOriented Database Management System: The Story of O2*, Morgan Kauffman, 1992.Google Scholar - [Bau92]M. Baudinet, A Simple Proof of the Completeness of Temporal Logic Programming, In: L. F. Del Cerro and M. Penttonen,
*Intensional Logics for Programming*, Studies in Logic and Computation, 1 Clarendon Press, pp. 51–83, 1992.Google Scholar - [Bru93]K. Bruce, Safe Type Checking in a Statically Typed Object-Oriented Programming Language, Proceedings of the ACM Conference on Functional Programming, pp. 285–298, ACM 1993.Google Scholar
- [BCM93]K. Bruce, J. Crabtree, T. P. Murtagh and R. van Gent, A. Dimock and R. Muller, Safe and Decidable Type Checking in an Object-Oriented Language, Proceedings of the OOPSLA Conference, pp. 29–46, 1993.Google Scholar
- [BSG95]K. Bruce, A. Schuett, and R. van Gent, PolyTOIL: a Type-Safe Polymorphic Object Oriented Language,
*Proceedings of ECOOP '95, Lecture Notes in Computer Science Vol. 952*, pp. 27–51, Springer-Verlag, 1996.Google Scholar - [BC96]J. Boyland and G. Castagna, Type-Safe Compilation of Covariant Specialization: a Practical Case, Proceedings of ECOOP '96,
*Lecture Notes in Computer Science*, Vol. 1098, pp. 3–25, Springer-Verlag, 1996.Google Scholar - [Cas95]G. Castagna, Covariance and Contravariance: Conflict Without a Cause,
*ACM Transactions on Programming Languages and Systems*, Vol. 17 (3) pp. 431–447, 1995.Google Scholar - [CCH89]P. Canning, W. Cook, W. Hill, W. Olthoff and J.C. Mitchell, F-Bounded Polymorphism for Object-Oriented Programming, Proceedings of the ACM Conference on Functional Programming Languages and Computer Architecture, pp. 273–280, 1989.Google Scholar
- [CHC90]W. R. Cook, W. L. Hill and P. S. Canning, Inheritance is not Subtyping, Proceedings of the ACM Conference on Principles of Programming Languages, pp. 125–135, 1990.Google Scholar
- [Coo89]W. R. Cook, A Proposal for Making Eiffel Type Safe,
*The Computer Journal*, Vol. 32, no. 4, pp. 305–311, 1989.Google Scholar - [GM96]A. Gawecki and F. Matthes, Integrating Subtyping, Matching and Type Quantification: A Practical Perspective, Proceedings of ECOOP '96,
*Lecture Notes in Computer Science*, Vol. 1098, pp. 25–47, Springer-Verlag, 1996.Google Scholar - [Gog91]J. Goguen, Types as Theories, In: G.M. Reed, A. W. Roscoe and R.F. Wachter,
*Topology and Category Theory in Computer Science*, pp. 357–390, Clarendon Press, 1991.Google Scholar - [GM87]J. Goguen and J. Meseguer, Unifying Functional, Object-Oriented and Relational Programming with Logical Semantics, In B. Shriver and P. Wegner, editors,
*Research Directions in Object-Oriented Programming*, pp. 417–477, MIT Press, 1987.Google Scholar - [Fis94]M. Fisher, A Survey of Concurrent METATEM-The Language and its Applications, Proceedings of the 2nd Temporal Logic Conference,
*Lecture Notes in AI*, pp. 48–66, Springer-Verlag, 1994.Google Scholar - [FM94]J. L. Fiadeiro and T. Maibaum, Sometimes “Tomorrow” is “ Sometime” Action Refinement in a Temporal Logic of Objects, Proc. of the 2nd International Temporal Logic Conference,
*Lecture Notes in AI*, pp. 48–66, Springer-Verlag, 1994.Google Scholar - [KLW93]M. Kifer, G. Lausen, and J.Wu, Logical Foundation of Object-Oriented and Frame-Based Languages, Technical Report 93/06, Department of Computer Science, SUNY at Stony Brook, to appear in the Journal of the ACM.Google Scholar
- [Kro87]F. Kroger,
*Temporal Logic of Programs*, EATCS Monograph on Theoretical Computer Science, New York, Springer-Verlag, 1987.Google Scholar - [LW94]B. Liskov and J. M. Wing, A behavioral notion of subtyping,
*ACM Transactions on Programming Languages and Systems*,*16*, pp. 1811–1841, 1994.Google Scholar - [Mes93]J. Meseguer, Solving the Inheritance Anomaly in Concurrent Object-Oriented Programming, Proceedings of ECOOP '93,
*Lecture Notes in Computer Science*, Vol. 707, pp. 220–246, 1993.Google Scholar - [Mey92]B. Meyer. Eiffel:
*the Language*, Prentice-Hall, 1992.Google Scholar - [WJS94]R. Wieringa, W. de Jonge and P. Spruit., Roles and Dynamic Subclasses: A Modal Logic Approach, Proceedings of the ECOOP Conference,
*Lecture Notes in Computer Science*, Vol. 821, pp. 33–59, 1994.Google Scholar