Advertisement

IsoLATE: A Type System for Self-recursion

  • Ravi ChughEmail author
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9032)

Abstract

A fundamental aspect of object-oriented languages is how recursive functions are defined. One semantic approach is to use simple record types and explicit recursion (i.e. fix) to define mutually recursive units of functionality. Another approach is to use records and recursive types to describe recursion through a “self” parameter. Many systems rely on both semantic approaches as well as combinations of universally quantified types, existentially quantified types, and mixin operators to encode patterns of method reuse, data encapsulation, and “open recursion” through self. These more complex mechanisms are needed to support many important use cases, but they often lack desirable theoretical properties, such as decidability, and can be difficult to implement, because of the equirecursive interpretation that identifies mu-types with their unfoldings. Furthermore, these systems do not apply to languages without explicit recursion (such as JavaScript, Python, and Ruby). In this paper, we present a statically typed calculus of functional objects called ISOLATE that can reason about a pattern of mixin composition without relying on an explicit fixpoint operation. To accomplish this, ISOLATE extends a standard isorecursive type system with a mechanism for checking the “mutual consistency” of a collection of functions, that is, that all of the assumptions about self are implied by the collection itself. We prove the soundness of ISOLATE via a type-preserving translation to a calculus with F-bounded polymorphism. Therefore, ISOLATE can be regarded as a stylized subset of the more expressive calculus that admits an interesting class of programs yet is easy to implement. In the future, we plan to investigate how other, more complicated forms of mixin composition (again, without explicit recursion) may be supported by lightweight type systems.

Keywords

Type System Operational Semantic Recursive Function Recursive Call Open Recursion 
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.

References

  1. 1.
    Ancona, D., Zucca, E.: A Calculus of Module Systems. Journal of Functional Programming (JFP) (2002)Google Scholar
  2. 2.
    Baldan, P., Ghelli, G., Raffaetà, A.: Basic Theory of F-bounded Quantification. Information and Computation (1999)Google Scholar
  3. 3.
    Boudol, G.: The Recursive Record Semantics of Objects Revisited. Journal of Functional Programming (JFP) (2004)Google Scholar
  4. 4.
    Bracha, G.: The Programming Language Jigsaw: Mixins, Modularity and Multiple Inheritance. PhD thesis, University of Utah (1992)Google Scholar
  5. 5.
    Bruce, K.B., Cardelli, L., Pierce, B.C.: Comparing Object Encodings. Information and Computation (1999)Google Scholar
  6. 6.
    Canning, P., Cook, W., Hill, W., Olthoff, W., Mitchell, J.C.: F-bounded Polymorphism for Object-oriented Programming. In: Functional Programming Languages and Architecture (FPCA) (1989)Google Scholar
  7. 7.
    Cardelli, L.: A Semantics of Multiple Inheritance. In: Plotkin, G., MacQueen, D.B., Kahn, G. (eds.) Semantics of Data Types 1984. LNCS, vol. 173, pp. 51–67. Springer, Heidelberg (1984)Google Scholar
  8. 8.
    Cardelli, L.: Amber. In: Cousineau, G., Curien, P.-L., Robinet, B. (eds.) LITP 1985. LNCS, vol. 242, pp. 21–47. Springer, Heidelberg (1986)Google Scholar
  9. 9.
    Cardelli, L., Wegner, P.: On Understanding Types, Data Abstraction, and Polymorphism. Computing Surveys (1985)Google Scholar
  10. 10.
    Chugh, R.: IsoLate: A Type System for Self-Recursion, Extended Version (2015)Google Scholar
  11. 11.
    Damas, L., Milner, R.: Principal Type-Schemes for Functional Programs. In: Principles of Programming Languages (POPL) (1982)Google Scholar
  12. 12.
    Dreyer, D.: A Type System for Well-Founded Recursion. In: Principles of Programming Languages (POPL) (2004)Google Scholar
  13. 13.
    Dreyer, D.: A Type System for Recursive Modules. In: International Conference on Functional Programming (ICFP) (2007)Google Scholar
  14. 14.
    Duggan, D., Sourelis, C.: Mixin Modules. In: International Conference on Functional Programming, (ICFP) (1996)Google Scholar
  15. 15.
    Fisher, K., Reppy, J.: A Typed Calculus of Traits. In: Workshop on Foundations of Object-Oriented Programming (FOOL) (2004)Google Scholar
  16. 16.
    Ghelli, G.: Recursive Types Are Not Conservative Over Fsub. In: Bezem, M., Groote, J.F. (eds.) TLCA 1993. LNCS, vol. 664, pp. 146–162. Springer, Heidelberg (1993)Google Scholar
  17. 17.
    Greenman, B., Muehlboeck, F., Tate, R.: Getting F-Bounded Polymorphism Back in Shape. In: Programming Language Design and Implementation (PLDI) (2014)Google Scholar
  18. 18.
    Gunter, C.A., Mitchell, J.C. (eds.): Theoretical Aspects of Object-Oriented Programming: Types, Semantics, and Language Design. MIT Press (1994)Google Scholar
  19. 19.
    Hirschowitz, T., Leroy, X.: Mixin Modules in a Call-by-Value Setting. In: ACM Transactions on Programming Languages and Systems (TOPLAS) (2005)Google Scholar
  20. 20.
    Igarashi, A., Viroli, M.: Variant Parametric Types: A Flexible Subtyping Scheme for Generics. In: ACM Transactions on Programming Languages and Systems (TOPLAS) (2006)Google Scholar
  21. 21.
    Im, H., Nakata, K., Garrigue, J., Park, S.: A Syntactic Type System for Recursive Modules. In: Object-Oriented Programming Systems, Languages, and Applications (OOPSLA) (2011)Google Scholar
  22. 22.
    Jim, T.: What Are Principal Typings and What Are They Good For? In: Principles of Programming Languages (POPL) (1996)Google Scholar
  23. 23.
    Kennedy, A.J., Pierce, B.C.: On Decidability of Nominal Subtyping with Variance, 2006. In: FOOL-WOOD (2007)Google Scholar
  24. 24.
    Leroy, X., Doligez, D., Frisch, A., Rémy, D., Vouillon, J.: OCaml System Release 4.02: Documentation and User’s Manual (2014), http://caml.inria.fr/pub/docs/manual-ocaml-4.02/
  25. 25.
    Mycroft, A.: Polymorphic Type Schemes and Recursive Definitions. In: Paul, M., Robinet, B. (eds.) Programming 1984. LNCS, vol. 167, pp. 217–228. Springer, Heidelberg (1984)Google Scholar
  26. 26.
    Nanevski, A., Pfenning, F., Pientka, B.: Contextual Modal Type Theory. Transactions on Computational Logic (2008)Google Scholar
  27. 27.
    Petricek, T., Orchard, D., Mycroft Coeffects, A.: Coeffects: Unified Static Analysis of Context-Dependence. In: Fomin, F.V., Freivalds, R., Kwiatkowska, M., Peleg, D. (eds.) ICALP 2013, Part II. LNCS, vol. 7966, pp. 385–397. Springer, Heidelberg (2013)Google Scholar
  28. 28.
    Benjamin, C.: Pierce. Bounded Quantification is Undecidable. In: Principles of Programming Languages (POPL) (1992)Google Scholar
  29. 29.
    Pierce, B.C.: Types and Programming Languages. MIT Press (2002)Google Scholar
  30. 30.
    Pierce, B.C., Turner, D.N.: Simple Type-Theoretic Foundations for Object-Oriented Programming. Journal of Functional Programming (JFP) (1994)Google Scholar
  31. 31.
    Rémy, D., Vouillon, J.: Objective ML: A Simple Object-Oriented Extension of ML. In: Principles of Programming Languages (POPL) (1997)Google Scholar
  32. 32.
    Rossberg, A., Dreyer, D.: Mixin’ Up the ML Module System. In: ACM Transactions on Programming Languages and Systems (TOPLAS) (2013)Google Scholar
  33. 33.
    Russo, C.: Recursive Structures for Standard ML. In: International Conference on Functional Programming (ICFP) (2001)Google Scholar
  34. 34.
    Torgersen, M., Hansen, C.P., Ernst, E.: Adding Wildcards to the Java Programming Language. Journal of Object Technology (2004)Google Scholar
  35. 35.
    Wand, M.: Complete Type Inference for Simple Objects. In: Logic in Computer Science (LICS) (1987)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2015

Authors and Affiliations

  1. 1.University of ChicagoChicagoUSA

Personalised recommendations