Abstract
Nominal subtyping forces programmers to explicitly state all of the subtyping relationships in the program. This limits component reuse, because programmers cannot anticipate all of the contexts in which a particular class might be used. In contrast, structural subtyping implicitly allows any type with appropriate structure to be used in a given context. Languagues with contracts exacerbate the problem. Since contracts are typically expressed as refinements of types, contracts in nominally typed languages introduce additional obstacles to reuse.
To overcome this problem we show how to extend a nominally typed language with semantic casts that introduce a limited form of structural subtyping. The new language must dynamically monitor contracts, as new subtyping relationships are exploited via semantic casts. In addition, it must also track the casts to properly assign blame in case interface contract are violated.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
America, P.: Designing an object-oriented programming language with behavioural subtyping. In: de Bakker, J.W., Rozenberg, G., de Roever, W.-P. (eds.) REX 1990. LNCS, vol. 489, pp. 60–90. Springer, Heidelberg (1991)
Bartetzko, D., Fischer, C., Moller, M., Wehrheim, H.: Jass - Java with assertions. In: Workshop on Runtime Verification, 2001. Held in conjunction with the 13th Conference on Computer Aided Verification, CAV (2001)
Bruce, K.B., Fiech, A., Petersen, L.: Subtyping is not a good “match” for object-oriented languages. In: Proceedings of European Conference on Object-Oriented Programming, pp. 104–127 (1997)
Bruce, K.B., Schuett, A., van Gent, R.: PolyTOIL:Atype-safe polymorphic object-oriented language. In: Olthoff, W. (ed.) ECOOP 1995. LNCS, vol. 952, pp. 27–51. Springer, Heidelberg (1995)
Carrillo-Castellon, M., Garcia-Molina, J., Pimentel, E., Repiso, I.: Design by contract in smalltalk. Journal of Object-Oriented Programming 7(9), 23–28 (1996)
Cheon, Y.: A runtime assertion checker for the Java Modelling Language. Technical Report 03-09, Iowa State University Computer Science Department (April 2003)
Detlefs, D.L., Rustan, K., Leino, M., Nelson, G., Saxe, J.B.: Extended static checking. Technical Report 158, Compaq SRC Research Report (1998)
Duncan, A., Hölzle, U.: Adding contracts to Java with handshake. Technical Report TRCS98-32, The University of California at Santa Barbara (December 1998)
Findler, R.B., Clements, J., Flanagan, C., Flatt, M., Krishnamurthi, S., Steckler, P., Felleisen, M.: DrScheme: A programming environment for Scheme. PLILP 1997 12(2), 159–182 (2002); Hartel, P.H., Kuchen, H. (eds.) PLILP 1997. LNCS, vol. 1292, pp. 369–388. Springer, Heidelberg (1997)
Findler, R.B., Felleisen, M.: Contract soundness for object-oriented languages. In: Object- Oriented Programming, Systems, Languages, and Applications (2001)
Findler, R.B., Felleisen, M.: Contracts for higher-order functions. In: Proceedings of ACM SIGPLAN International Conference on Functional Programming (2002)
Findler, R.B., Latendresse, M., Felleisen, M.: Behavioral contracts and behavioral subtyping. In: Proceedings of ACM Conference Foundations of Software Engineering (2001)
Fisher, K., Reppy, J.H.: The design of a class mechanism for Moby. In: Proceedings of ACM SIGPLAN Conference on Programming Language Design and Implementation (1999)
Flanagan, C., Leino, K.R.M., Lillibridge, M., Nelson, G., Saxe, J.B., Stata, R.: Extended static checking for Java. In: Proceedings of ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 234–245 (2002)
Flatt, M.P.: MzScheme: Language manual. Technical Report TR97-280, Rice University (1997), http://www.mzscheme.org/
Flatt, M., Krishnamurthi, S., Felleisen, M.: Classes and mixins. In: Proceedings of the ACM Conference Principles of Programming Languages, Janurary 1998, pp. 171–183 (1998)
Gomes, B., Stoutamire, D., Vaysman, B., Klawitter, H.: A Language Manual for Sather 1.1 (August 1996)
Gosling, J., Joy, B., Guy Steele, J.: The Java(tm) Language Specification. Addison-Wesley, Reading (1996)
Guttag, J.V., Horning, J.J.: Larch: Languages andTools forFormal Specification. Springer, Heidelberg (1993)
Henglein, F.: Dynamic typing: Syntax and proof theory. Science of Computer Programming 22(3), 197–230 (1994)
Holt, R.C., Cordy, J.R.: The Turing programming language. Communications of the ACM 31, 1310–1423 (1988)
Karaorman, M., Hölzle, U., Bruno, J.: jContractor: A reflective Java library to support design by contract. In: Cointe, P. (ed.) Reflection 1999. LNCS, vol. 1616, p. 175. Springer, Heidelberg (1999)
Kizub, M.: Kiev language specification (1998), http://www.forestro.com/kiev/
Kölling, M., Rosenberg, J.: Blue: Language Specification, version 0.94 (1997)
Kramer, R.: iContract: The Java design by contract tool. In: Technology of Object-Oriented Languages and Systems (1998)
Lampson, B.W., Horning, J.J., London, R.L., Mitchell, J.G., Popek, G.J.: Report on the programming language Euclid. ACM Sigplan Notices 12(2) (Feburary 1977)
Leavens, G.T., Leino, K.R.M., Poll, E., Ruby, C., Jacobs, B.: JML: notations and tools supporting detailed design in Java. In: Object-Oriented Programming, Systems, Languages, and Applications Companion, Also Department of Computer Science, Iowa State University, TR 00-15, August 2000, pp. 105–106 (2000)
Leroy, X.: Applicative functors and fully transparent higher-order modules. In: Proceedings of the ACM Conference Principles of Programming Languages, pp. 142–153. ACM Press, New York (1995)
Leroy, X.: The Objective Caml system, Documentation and User’s guide (1997)
Liskov, B.H., Wing, J.: Behavioral subtyping using invariants and constraints. Technical Report CMU CS-99-156, School of Computer Science, Carnegie Mellon University (July 1999)
Luckham, D.C., von Henke, F.: An overview of Anna, a specification language for Ada. IEEE Software 2, 9–23 (1985)
Man Machine Systems. Design by contract for Java using JMSAssert (2000), http://www.mmsindia.com/DBCForJava.html
Meyer, B.: Eiffel: The Language. Prentice Hall, Englewood Cliffs (1992)
Microsoft Corporation. Microsoft C# Language Specifications. Microsoft Press (2001)
Milner, R., Tofte, M., Harper, R.: The Definition of Standard ML. MIT Press, Cambridge (1990)
Object Management Group. The object management architecture guide (1997), http://www.omg.org/
Parnas, D.L.: A technique for software module specification with examples. Communications of the ACM 15(5), 330–336 (1972)
Plösch, R.: Design by contract for Python. In: IEEE Proceedings of the Joint Asia Pacific Software Engineering Conference (1997), http://citeseer.nj.nec.com/257710.html
Plösch, R., Pichler, J.: Contracts: From analysis to C++ implementation. In: Technology of Object-Oriented Languages and Systems, pp. 248–257 (1999)
Rémy, D., Vouillon, J.: Objective ML: A simple object-oriented extension of ML. In: Proceedings of the ACM Conference Principles of Programming Languages, January 1997, pp. 40–53 (1997)
Rosenblum, D.S.: A practical approach to programming with assertions. IEEE Transactions on Software Engineering 21(1), 19–31 (1995)
Sannella, D.: Formal program development in Extended ML for the working programmer. In: Proc. 3rd BCS/FACS Workshop on Refinement; Springer Workshops in Computing, pp. 99–130 (1991)
Sannella, D., Tarlecki, A.: Essential concepts of algebraic specification and program development. Formal Aspects of Computing 9, 229–269 (1997), http://www.dcs.ed.ac.uk/home/dts/eml/
Scott, D.S.: Data types as lattices. Society of Industrial and Applied Mathematics (SIAM) Journal of Computing 5(3), 522–586 (1976)
Stroustrup, B.: The C++ Programming Language. Addison-Wesley, Reading (1997)
Szyperski, C.: Component Software, 2nd edn. Addison-Wesley, Reading (1998)
Wright, A., Felleisen, M.: A syntactic approach to type soundness. Information and Computation, pp. 38–94 (1994); First appeared as Technical Report TR160, Rice University (1991)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2004 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Findler, R.B., Flatt, M., Felleisen, M. (2004). Semantic Casts: Contracts and Structural Subtyping in a Nominal World. In: Odersky, M. (eds) ECOOP 2004 – Object-Oriented Programming. ECOOP 2004. Lecture Notes in Computer Science, vol 3086. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-24851-4_17
Download citation
DOI: https://doi.org/10.1007/978-3-540-24851-4_17
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-22159-3
Online ISBN: 978-3-540-24851-4
eBook Packages: Springer Book Archive