Advertisement

Formal Aspects of Computing

, Volume 9, Issue 1, pp 49–67 | Cite as

Type inference with non-structural subtyping

  • Jens Palsberg
  • Mitchell Wand
  • Patrick O'Keefe
Article

Abstract

We present an O(n3) time type inference algorithm for a type system with a largest typeΤ, a smallest type ⊥, and the usual ordering between function types. The algorithm infers type annotations of least shape, and it works equally well for recursive types. For the problem of typability, our algorithm is simpler than the one of Kozen, Palsberg, and Schwartzbach for type inferencewithout ⊥. This may be surprising, especially because the system with ⊥ is strictly more powerful.

Keywords

Languages Type systems Constraints Algorithms 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [AmC93]
    Amadio, R. M. and Cardelli, L.: Subtyping recursive types.ACM Transactions on Programming Languages and Systems, 15(4):575–631, 1993. Also in Proc. POPL'91.Google Scholar
  2. [KPS94]
    Kozen, D., Palsberg, J. and Schwartzbach, M. I.: Efficient inference of partial types.Journal of Computer and System Sciences, 49(2):306–324, 1994. Preliminary version in Proc. FOCS'92, 33rd IEEE Symposium on Foundations of Computer Science, pages 363–371, Pittsburgh, Pennsylvania, October 1992.Google Scholar
  3. [KPS95]
    Kozen, D., Palsberg, J. and Schwartzbach, M. I.: Efficient recursive subtyping.Mathematical Structures in Computer Science, 5(1):113–125, 1995. Preliminary version in Proc. POPL'93, Twentieth Annual SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 419–428, Charleston, South Carolina, January 1993.Google Scholar
  4. [Mit84]
    Mitchell, J.: Coercion and type inference. InEleventh Symposium on Principles of Programming Languages, pages 175–185, 1984.Google Scholar
  5. [Mit91]
    Mitchell, J. C.: Type inference with simple subtypes.Journal of Functional Programming, 1:245–285, 1991.Google Scholar
  6. [PoO95]
    Palsberg, J. and O'Keefe, P. M.: A type system equivalent to flow analysis.ACM Transactions on Programming Languages and Systems, 17(4):576–599, July 1995. Preliminary version in Proc. POPL'95, 22nd Annual SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 367–378, San Francisco, California, January 1995.Google Scholar
  7. [PaS92]
    Palsberg, J. and Schwartzbach, M. I.: Safety analysis versus type inference for partial types.Information Processing Letters, 43:175–180, 1992.Google Scholar
  8. [Tha88]
    Thatte, S.: Type inference with partial types. InProc. International Colloquium on Automata, Languages, and Programming 1988, pages 615–629. Springer-Verlag(LNCS 317), 1988.Google Scholar
  9. [Wan91]
    Wand, M.: Type inference for record concatenation and multiple inheritance.Information and Computation, 93(1):1–15, 1991.Google Scholar
  10. [WOP95]
    Wand, M., O'Keefe, P. M. and Palsberg, J.: Strong normalization with non-structural subtyping.Mathematical Structures in Computer Science, 5(3):419–430, 1995.Google Scholar

Copyright information

© BCS 1997

Authors and Affiliations

  1. 1.Department of Computer SciencePurdue UniversityW. LafayetteUSA
  2. 2.College of Computer ScienceNortheastern UniversityBostonUSA
  3. 3.WatertownUSA

Personalised recommendations