skip to main content
article
Free Access

Explaining type errors in polymorphic languages

Published:01 March 1993Publication History
Skip Abstract Section

Abstract

Strongly-typed languages present programmers with compile-time feedback about the type correctness of programs. Errors during polymorphic type checking take the form of a unification failure for two types. Finding the source of the type error in the code is often difficult because the error may occur far from the spot where the inconsistency is detected. As functional languages use more and more complex type systems, the difficulty of interpreting and locating these errors will increase. To locate the source of type errors the programmer must unravel the long chain of deductions and type instantiations made during type reconstruction. This paper describes an approach that maintains the deductive steps of type inference and the reasons for type instantiations. The approach could be used in an interactive system to guide the programmer to the source of a type error or to explain why the compiler assigned a particular type to an expression.

References

  1. APPEL, A. W., AND MACQUEEN, D.B. 1991. Standard ML of New Jersey. In Programming Language Implementation and Logic Programming (Berlin). M. Wirsing, Ed., Springer-Verlag, New York, 1-13.Google ScholarGoogle Scholar
  2. CARDELLI, L. 1987. Basic polymorphic type checking. Sci. Comput. Program. 8, 2 (April), 147-172. Google ScholarGoogle Scholar
  3. JOHNSON, G. F., AND WALZ, J.A. 1986. A maximum-flow approach to anomaly isolation in unification-based incremental type inference. In Conference Record of the 13th Annual ACM Symposium on Principles of Programming Languages (Jan.), 44-57. Google ScholarGoogle Scholar
  4. MILNER, Ro 1987. A theory of type polymorphism. J. Comput. Syst. Sci. 17, 348-375.Google ScholarGoogle Scholar
  5. MILNER, R., TOFTE, M., AND HARPER, R. 1990. The Definition of Standard ML. MIT Press, Cambridge, Mass. Google ScholarGoogle Scholar
  6. READE, C. 1989. Elements of Functional Programming Addison Wesley, Reading, Mass. Google ScholarGoogle Scholar
  7. SERGOT, M. J., SADRI, F., KOWALSKI, R. A., KRIWAACZEK, F., HAMMOND, P., AND CORY, H.T. 1986. The British Nationality Act. Commun. ACM 29, 5 (May), 370-386. Google ScholarGoogle Scholar
  8. SOOSAIPILLAI, H. 1990. An explanation based polymorphic type check for Standard ML. Master's thesis. Heriot-Watt Univ., Edinburgh, U.K.Google ScholarGoogle Scholar
  9. WAND, M. 1986. Finding the source of type errors. In Conference Record of the 13th Annual ACM Symposium on Principles of Programming Languages (Jan.) 38-43. Google ScholarGoogle Scholar

Index Terms

  1. Explaining type errors in polymorphic languages

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image ACM Letters on Programming Languages and Systems
          ACM Letters on Programming Languages and Systems  Volume 2, Issue 1-4
          March–Dec. 1993
          241 pages
          ISSN:1057-4514
          EISSN:1557-7384
          DOI:10.1145/176454
          Issue’s Table of Contents

          Copyright © 1993 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 1 March 1993
          Published in loplas Volume 2, Issue 1-4

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • article

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!