Advertisement

Typed object-oriented functional programming with late binding

  • Zhenyu Qian
  • Bernd Krieg-Brückner
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1098)

Abstract

Object-oriented programming languages are suitable for describing real-world objects, functional programming languages for algebraic values. In this paper we propose an object-oriented functional programming language, called TOFL, which combines many desired properties of the two paradigms. In particular, TOFL unifies object classes, inheritance, (method) redefinitions and late binding as in object-oriented languages, algebraic data types, higher-order functions, type classes and type inference (without type reconstruction in this paper) as in functional languages. We translate TOFL into a stratified and explicitly typed λ-calculus T with overloaded functions, where redefinitions and late binding become late binding of overloaded functions. The operational semantics of T gives a semantics and a simple prototyping implementation of TOFL.

Keywords

Type Inference Functional Language Ground Type Type Constructor Polymorphic Type 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Special issue on type systems for object-oriented programming. J. Functional Programming, 4(2), 1994.Google Scholar
  2. 2.
    M. Abadi and L. Cardelli. A theory of primitive objects: second-order systems. In Proc. European Symp./ on Programming. Springer LNCS, 1994.Google Scholar
  3. 3.
    M. Abadi and L. Cardelli. A theory of primitive objects: untyped and first-order systems. In Proc. Theoretical Aspects of Computer Software. Springer LNCS, 1994.Google Scholar
  4. 4.
    Apple Computer Inc., Eastern Research and Technology. Dylan: an object-oriented dynamic language. Technical report, 1992.Google Scholar
  5. 5.
    D. Bobrow, L. DeMichiel, R. Gabriel, S. Keene, G. Kiczales, and D. Moon. Common List Object System Specification. SIGPLAN Notice, 23, 1988.Google Scholar
  6. 6.
    K. Bruce. Typing in object-oriented languages: Achieving expressibility and safety. Technical report, Williams College, 1995. http://www.cs.williams.edu/~kim/.Google Scholar
  7. 7.
    K. Bruce, A. Schuett, and R. van Gent. PolyTOIL: A type-safe polymorphic object-oriented language (extended abstract). In Proc. 9th ECOOP. Springer LNCS, 1995.Google Scholar
  8. 8.
    P. Canning, W. Cook, W. Hill, and W. Olthoff. Interfaces for strongly-typed object-oriented programming. In Proc. OOPSLA'89, pages 457–467. 1989.Google Scholar
  9. 9.
    L. Cardelli. A semantics of multiple inheritance. Information and Computation, 76:130–164, 1988.MathSciNetCrossRefGoogle Scholar
  10. 10.
    L. Cardelli. Extensible records in a pure calculus of subtyping. In C. Gunter and J. Mitchell, editors, Theoretical Aspects of Object-Oriented Programming: Types, Semantics, and Language Design. The MIT Press, 1994.Google Scholar
  11. 11.
    L. Cardelli and G. Longo. A semantics for Quest. J. of Functional programming, 1(4):417–458, 1991.MathSciNetzbMATHGoogle Scholar
  12. 12.
    L. Cardelli and P. Wegner. On understanding types, data abstraction, and polymorphism. Computing Surveys, 17(4):471–522, 1985.CrossRefGoogle Scholar
  13. 13.
    G. Castagna. Covariance and contravariance: Conflict without a cause. Trans. on Prog. Lang. and Sys., 17(3), 1995.Google Scholar
  14. 14.
    G. Castagna. Integration of parametric and ad hoc second order polymorphism in a calculus with subtyping. Formal Aspects of Computing, 1995. To appear.Google Scholar
  15. 15.
    G. Castagna, G. Ghelli, and G. Longo. A calculus for overloaded functions with subtyping. Information and Computation, 1995. To appear.Google Scholar
  16. 16.
    W. Cook. A proposal for making eiffel type-safe. In Proc. European Conf. on Object-oriented Programming, 1989.Google Scholar
  17. 17.
    W. Cook, W. Hill, and P. Canning. Inheritance is not subtyping. In Proc. 17th ACM Symp. Principles of Programming Languages. 1990.Google Scholar
  18. 18.
    P.-L. Curien and G. Ghelli. Coherence of subsumption, minimum typing and the type checking in F . Mathematical Structiures in Computer Science, 2(1), 1992.Google Scholar
  19. 19.
    L. Damas and R. Milner. Principal type schemes for functional programs. In Proc. 9th ACM Symp. Principles of Programming Languages, pages 207–212, 1982.Google Scholar
  20. 20.
    Y.-C. Fuh and P. Mishra. Type inference with subtypes. Theoretical Computer Science, 73:155–175, 1990.MathSciNetCrossRefzbMATHGoogle Scholar
  21. 21.
    K. Futatsugi, J. Goguen, J.-P. Jouannaud, and J. Meseguer. Principles of OBJ2. In Proc. 12th ACM Symp. Principles of Programming Languages, pages 52–66, 1985.Google Scholar
  22. 22.
    G. Ghelli. A static type system for message passing. In Proc. of OOPSLA'91. 1991.Google Scholar
  23. 23.
    G. Ghelli. Divergence of F type checking. Tech. Rep. 5/93, University of Pisa, 1993.Google Scholar
  24. 24.
    J. Goguen and J. Meseguer. Order-sorted algebra I: Equational deduction for multiple inheritance, polymorphism, and partial operations. Technical report, SRI, 1989.Google Scholar
  25. 25.
    C. Gunter and J. Mitchell (Eds.). Theoretical Aspects of Object-Oriented Programming: Types, Semantics, and Language Design. The MIT Press, 1994.Google Scholar
  26. 26.
    R. Harper and J. Mitchell. The essence of ML. In Proc. 15th ACM Symp. Principles of Programming Languages, pages 28–46, 1988.Google Scholar
  27. 27.
    F. Henglein. Type inference with polymrophic recursion. ACM Trans. on Prog. Lang. and Sys., 15(2):253–289, 1993.CrossRefGoogle Scholar
  28. 28.
    M. Hoang and J. Mitchell. Lower bounds on type inference with subtypes. In Proc. 22nd ACM Symp. Principles of Programming Languages, pages 176–185, 1995.Google Scholar
  29. 29.
    P. Hudak, S. Peyton Jones, and P. Wadler (Editors). Report on the programming language Haskell: A non-strict, purely functional language (version 1.2). ACM SIGPLAN Notices, 27(5), 1992.Google Scholar
  30. 30.
    J. Hughes and J. Sparud. Haskell++: An object-oriented extension of haskell. In Proc. 1995 Workshop on Haskell, 1995.Google Scholar
  31. 31.
    A. Kfoury, J. Tiuryn, and P. Urzyczyn. Type reconstruction in the presence of polymrophic recursion. ACM Trans. on Prog. Lang. and Sys., 15(2):290–311, 1993.CrossRefGoogle Scholar
  32. 32.
    K. Läufer. Combining type classes and existential types. In Proc. Latin American Informatics Conference (PANEL). ITESM-CEM, Mexico, Sept. 1994.Google Scholar
  33. 33.
    K. Läufer and M. Odersky. Polymorphic type inference and abstract data types. ACM Transactions on Programming Languages and Systems, 1994.Google Scholar
  34. 34.
    B. Meyer. Object-Oriented Software Construction. Prentice Hall, 1988.Google Scholar
  35. 35.
    R. Milner, M. Tofte, and R. Harper. The Definition of Standard ML. MIT Press, 1990.Google Scholar
  36. 36.
    J. Mitchell and G. Plotkin. Abstract types have existential type. ACM Trans. on Prog. Lang. and Sys, 10(3):475–502, 1988.Google Scholar
  37. 37.
    A. Mycroft. Polymorphic type schemes and recursive definitions. In Proc. Int. Symposium on Programming, pages 217–228. Springer LNCS 167, 1984.zbMATHMathSciNetGoogle Scholar
  38. 38.
    T. Nipkow and C. Prehofer. Type reconstruction for type classes. Journal of Functional Programming, 5(2):201–224, 1995.MathSciNetzbMATHGoogle Scholar
  39. 39.
    A. Ohori. A compilation method for ML-style polymorphic record calculi. In Proc. 19th ACM Symp. Principles of Programming Languages, pages 154–165, 1992.Google Scholar
  40. 40.
    J. Palsberg. Efficient type inference of object types. In Proc. IEEE Symposium on Logic in Computer Science, pages 186–195, 1994.Google Scholar
  41. 41.
    B. Pierce and D. Turner. Simple type-theoretical foundations for object-oriented programming. J. of Functional Programming, 4(2):207–247, 1994.CrossRefzbMATHGoogle Scholar
  42. 42.
    B. C. Pierce. Bounded quantification is undecidable. Information and Computation, 112(1):131–165, 1994.zbMATHMathSciNetCrossRefGoogle Scholar
  43. 43.
    Z. Qian and B. Krieg-Brückner. TOFL: a typed object-oriented functional programming language with late binding. Technical report, FB Informatik, Universität Bremen, March 1996.Google Scholar
  44. 44.
    Z. Qian and B. Krieg-Brückner. Object-oriented functional programming and type reconstruction. Nov. 1995. Submitted for publication.Google Scholar
  45. 45.
    D. Rémy. Typechecking records and variants in a natural extension of ml. In Proc. 16th ACM Symp. Principles of Programming Languages, pages 77–87, 1989.Google Scholar
  46. 46.
    G. S. Smith. Polymorphic type inference with overloading and subtyping. In J.-P. J. M.-C. Gaudel, editor, Proc. TAPSOFT'93, pages 670–685. Springer LNCS 668, 1993.Google Scholar
  47. 47.
    C. Strachey. Fundamental concepts in programming languages. In Lecture Notes for the Int. Summer School in Computer Programming, Copenhagen, August 1967.Google Scholar
  48. 48.
    C. Szyperski, S. Omohundro, and S. Murer. Engineering a programming language: The type and class system for Sather. In Programming Languages and System Architectures, pages 208–227. Springer LNCS 782, 1993.Google Scholar
  49. 49.
    P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad hoc. In Proc. 16th ACM Symp. Principles of Programming Languages, pages 60–76, 1989.Google Scholar
  50. 50.
    M. Wand. Complete type inference for simple objects. In Proc. 2nd IEEE Symp. Logic in Cornp. Sci., 1987. Corrigendum in Proc. 3rd IEEE Symp. Logic in Comp. Sci., 1988.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1996

Authors and Affiliations

  • Zhenyu Qian
    • 1
  • Bernd Krieg-Brückner
    • 1
  1. 1.FB3 InformatikUniversität BremenBremenGermany

Personalised recommendations