Coinductive Type Systems for Object-Oriented Languages

  • Davide Ancona
  • Giovanni Lagorio
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5653)

Abstract

We propose a novel approach based on coinductive logic to specify type systems of programming languages.

The approach consists in encoding programs in Horn formulas which are interpreted w.r.t. their coinductive Herbrand model.

We illustrate the approach by first specifying a standard type system for a small object-oriented language similar to Featherweight Java. Then we define an idealized type system for a variant of the language where type annotations can be omitted. The type system involves infinite terms and proof trees not representable in a finite way, thus providing a theoretical limit to type inference of object-oriented programs, since only sound approximations of the system can be implemented.

Approximation is naturally captured by the notions of subtyping and subsumption; indeed, rather than increasing the expressive power of the system, as it usually happens, here subtyping is needed for approximating infinite non regular types and proof trees with regular ones.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Agesen, O.: The cartesian product algorithm. In: Olthoff, W. (ed.) ECOOP 1995. LNCS, vol. 952, pp. 2–26. Springer, Heidelberg (1995)Google Scholar
  2. 2.
    Amadio, R., Cardelli, L.: Subtyping recursive types. ACM Transactions on Programming Languages and Systems 15(4) (1993)Google Scholar
  3. 3.
    Ancona, D., Ancona, M., Cuni, A., Matsakis, N.: RPython: a Step Towards Reconciling Dynamically and Statically Typed OO Languages. In: OOPSLA 2007 Proceedings and Companion, DLS 2007: Proceedings of the 2007 Symposium on Dynamic Languages. ACM Press, New York (2007)Google Scholar
  4. 4.
    Ancona, D., Damiani, F., Drossopoulou, S., Zucca, E.: Polymorphic bytecode: Compositional compilation for Java-like languages. In: ACM Symp. on Principles of Programming Languages 2005. ACM Press, New York (2005)Google Scholar
  5. 5.
    Ancona, D., Lagorio, G., Zucca, E.: True separate compilation of Java classes. In: PPDP 2002 - Principles and Practice of Declarative Programming. ACM Press, New York (2002)Google Scholar
  6. 6.
    Ancona, D., Lagorio, G., Zucca, E.: Type inference for polymorphic methods in Java-like languages. In: Italiano, G.F., Moggi, E., Laura, L. (eds.) ICTCS 2007 - 10th Italian Conf. on Theoretical Computer Science 2003, eProceedings. World Scientific, Singapore (2007)Google Scholar
  7. 7.
    Ancona, D., Zucca, E.: Principal typings for Java-like languages. In: ACM Symp. on Principles of Programming Languages 2004. ACM Press, New York (2004)Google Scholar
  8. 8.
    Barbanera, F., Dezani-Cincaglini, M., de’Liguoro, U.: Intersection and union types: Syntax and semantics. Information and Computation 119(2) (1995)Google Scholar
  9. 9.
    Brandt, M., Henglein, F.: Coinductive axiomatization of recursive type equality and subtyping. In: de Groote, P., Hindley, J.R. (eds.) TLCA 1997. LNCS, vol. 1210. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  10. 10.
    Brandt, M., Henglein, F.: Coinductive axiomatization of recursive type equality and subtyping. Fundam. Inform. 33(4) (1998)Google Scholar
  11. 11.
    Courcelle, B.: Fundamental properties of infinite trees. Theoretical Computer Science 25 (1983)Google Scholar
  12. 12.
    Furr, M., An, J., Foster, J.S., Hicks, M.: Static type inference for Ruby. In: SAC 2009 - 24th ACM Symp. on Applied Computing (2009)Google Scholar
  13. 13.
    Igarashi, A., Nagira, H.: Union types for object-oriented programming. Journ. of Object Technology 6(2) (2007)Google Scholar
  14. 14.
    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) (2001)Google Scholar
  15. 15.
    Lagorio, G., Zucca, E.: Just: safe unknown types in java-like languages. Journ. of Object Technology, 6(2) (February 2007); Special issue: OOPS track at SAC (2006)Google Scholar
  16. 16.
    Oxhøj, N., Palsberg, J., Schwartzbach, M.I.: Making type inference practical. In: Lehrmann Madsen, O. (ed.) ECOOP 1992. LNCS, vol. 615, pp. 329–349. Springer, Heidelberg (1992)CrossRefGoogle Scholar
  17. 17.
    Palsberg, J., Schwartzbach, M.I.: Object-oriented type inference. In: ACM Symp. on Object-Oriented Programming: Systems, Languages and Applications 1991 (1991)Google Scholar
  18. 18.
    Simon, L., Bansal, A., Mallya, A., Gupta, G.: Co-logic programming: Extending logic programming with coinduction. In: Arge, L., Cachin, C., Jurdziński, T., Tarlecki, A. (eds.) ICALP 2007. LNCS, vol. 4596, pp. 472–483. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  19. 19.
    Simon, L., Mallya, A., Bansal, A., Gupta, G.: Coinductive logic programming. In: Etalle, S., Truszczyński, M. (eds.) ICLP 2006. LNCS, vol. 4079, pp. 330–345. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  20. 20.
    Wang, T., Smith, S.: Polymorphic constraint-based type inference for objects. Technical report, The Johns Hopkins University (2008) (submitted for publication)Google Scholar
  21. 21.
    Wang, T., Smith, S.F.: Precise constraint-based type inference for java. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, p. 99. Springer, Heidelberg (2001)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Davide Ancona
    • 1
  • Giovanni Lagorio
    • 1
  1. 1.DISIUniv. of GenovaItaly

Personalised recommendations