Semantic Subtyping for Objects and Classes

  • Ornela Dardha
  • Daniele Gorla
  • Daniele Varacca
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7892)


We propose an integration of structural subtyping with boolean connectives and semantic subtyping to define a Java-like programming language that exploits the benefits of both techniques. Semantic subtyping is an approach to defining subtyping relation based on set-theoretic models, rather than syntactic rules. On the one hand, this approach involves some non trivial mathematical machinery in the background. On the other hand, final users of the language need not know this machinery and the resulting subtyping relation is very powerful and intuitive. While semantic subtyping is naturally linked to the structural one, we show how the framework can also accommodate the nominal subtyping. Several examples show the expressivity and the practical advantages of our proposal.


Operational Semantic Typing Rule Class Hierarchy Record Type Method Invocation 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Abadi, M., Cardelli, L.: A Theory of Primitive Objects - Untyped and First-Order Systems. In: Hagiya, M., Mitchell, J.C. (eds.) TACS 1994. LNCS, vol. 789, pp. 296–320. Springer, Heidelberg (1994)CrossRefGoogle Scholar
  2. 2.
    Agrawal, R., de Michiel, L.G., Lindsay, B.G.: Static type checking of multimethods. In: Proc. of OOPSLA, pp. 113–128. ACM Press (1991)Google Scholar
  3. 3.
    Aiken, A., Wimmers, E.L.: Type inclusion constraints and type inference. In: Proc. of FPCA, pp. 31–41. ACM (1993)Google Scholar
  4. 4.
    Ancona, D., Lagorio, G.: Coinductive type systems for object-oriented languages. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 2–26. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  5. 5.
    Boyland, J., Castagna, G.: Type-safe compilation of covariant specialization: A practical case. In: Cointe, P. (ed.) ECOOP 1996. LNCS, vol. 1098, pp. 3–25. Springer, Heidelberg (1996)CrossRefGoogle Scholar
  6. 6.
    Boyland, J.T., Castagna, G.: Parasitic Methods: an implementation of multi-methods for Java. In: Proc. of OOPSLA. ACM Press (1997)Google Scholar
  7. 7.
    Castagna, G.: Object-oriented programming: a unified foundation. Progress in Theoretical Computer Science series. Birkäuser, Boston (1997)Google Scholar
  8. 8.
    Castagna, G.: Semantic subtyping: Challenges, perspectives, and open problems. In: Coppo, M., Lodi, E., Pinna, G.M. (eds.) ICTCS 2005. LNCS, vol. 3701, pp. 1–20. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  9. 9.
    Castagna, G., De Nicola, R., Varacca, D.: Semantic subtyping for the pi-calculus. Theoretical Computer Science 398(1-3), 217–242 (2008)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Damm, F.M.: Subtyping with union types, intersection types and recursive types. In: Hagiya, M., Mitchell, J.C. (eds.) TACS 1994. LNCS, vol. 789, pp. 687–706. Springer, Heidelberg (1994)CrossRefGoogle Scholar
  11. 11.
    Dardha, O.: Sottotipaggio semantico per linguaggi ad oggetti. MS thesis, Dip. Informatica, “Sapienza” Univ. di Roma,
  12. 12.
    Findler, R.B., Flatt, M., Felleisen, M.: Semantic casts: Contracts and structural subtyping in a nominal world. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 365–389. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  13. 13.
    Frisch, A., Castagna, G., Benzaken, V.: Semantic subtyping: Dealing set-theoretically with function, union, intersection, and negation types. Journal of the ACM 55(4), 1–64 (2008)MathSciNetCrossRefGoogle Scholar
  14. 14.
    Gil, J., Maman, I.: Whiteoak: introducing structural typing into Java. In: Proc. of OOPSLA, pp. 73–90. ACM (2008)Google Scholar
  15. 15.
    Hosoya, H., Pierce, B.C.: Regular expression pattern matching for XML. SIGPLAN Notices 36(3), 67–80 (2001)CrossRefGoogle Scholar
  16. 16.
    Hosoya, H., Pierce, B.C.: Xduce: A statically typed XML processing language. ACM Transactions on Internet Technology 3(2), 117–148 (2003)CrossRefGoogle Scholar
  17. 17.
    Igarashi, A., Pierce, B.C., Wadler, P.: Featherweight Java: a minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems 23(3), 396–450 (2001)CrossRefGoogle Scholar
  18. 18.
    Leroy, X., Doligez, D., Garrigue, J., Rémy, D., Vouillon, J.: The Objective Caml system, release 3.11 (2008)Google Scholar
  19. 19.
    Malayeri, D., Aldrich, J.: Integrating nominal and structural subtyping. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 260–284. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  20. 20.
    Malayeri, D., Aldrich, J.: Is structural subtyping useful? An empirical study. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 95–111. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  21. 21.
    Odersky, M., Micheloud, S., Mihaylov, N., Schinz, M., Stenman, E., Zenger, M.: An overview of the Scala programming language. Technical report (2004)Google Scholar
  22. 22.
    Ostermann, K.: Nominal and structural subtyping in component-based programming. Journal of Object Technology 7(1), 121–145 (2008)CrossRefGoogle Scholar
  23. 23.
    Pearce, D.J.: Sound and complete flow typing with unions, intersections and negations. In: Giacobazzi, R., Berdine, J., Mastroeni, I. (eds.) VMCAI 2013. LNCS, vol. 7737, pp. 335–354. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  24. 24.
    Rémy, D., Vouillon, J.: Objective ML: A simple object-oriented extension of ML. In: Proc. of POPL, pp. 40–53. ACM (1997)Google Scholar
  25. 25.
    Sangiorgi, D., Walker, D.: The Pi-Calculus: A Theory of Mobile Processes. Cambridge University Press, New York (2003)Google Scholar

Copyright information

© IFIP International Federation for Information Processing 2013

Authors and Affiliations

  • Ornela Dardha
    • 1
  • Daniele Gorla
    • 2
  • Daniele Varacca
    • 3
  1. 1.INRIA Focus TeamUniversità di BolognaItaly
  2. 2.Dip. di Informatica“Sapienza” Università di RomaItaly
  3. 3.PPSUniversité Paris Diderot & CNRSFrance

Personalised recommendations