skip to main content
10.1145/1140335.1140356acmconferencesArticle/Chapter ViewAbstractPublication PagesppdpConference Proceedingsconference-collections
Article

Practical type inference based on success typings

Published: 10 July 2006 Publication History

Abstract

In languages where the compiler performs no static type checks, many programs never go wrong, but the intended use of functions and component interfaces is often undocumented or appears only in the form of comments which cannot always be trusted. This often makes program maintenance problematic. We show that it is possible to reconstruct a significant portion of the type information which is implicit in a program, automatically annotate function interfaces, and detect definite type clashes without fundamental changes to the philosophy of the language or imposing a type system which unnecessarily rejects perfectly reasonable programs. To do so, we introduce the notion of success typings of functions. Unlike most static type systems, success typings incorporate subtyping and never disallow a use of a function that will not result in a type clash during runtime. Unlike most soft typing systems that have previously been proposed, success typings allow for compositional, bottom-up type inference which appears to scale well in practice. Moreover, by taking control-flow into account and exploiting properties of the language such as its module system, success typings can be refined and become accurate and precise We demonstrate the power and practicality of the approach by applying it to Erlang. We report on our experiences from employing the type inference algorithm, without any guidance, on programs of significant size

References

[1]
A. Aiken and E. L. Wimmers. Type inclusion constraints and type inference. In Functional Programming Languages and Computer Architecture, pages 31--41, 1993.
[2]
A. Aiken, E. L. Wimmers, and T. K. Lakshman. Soft typing with conditional types. In Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 163--173. ACM Press, 1994.
[3]
J. Armstrong, R. Virding, C. Wikström, and M. Williams. Concurrent Programming in Erlang. Prentice Hall Europe, Herfordshire, Great Britain, second edition, 1996.
[4]
R. Carlsson. An introduction to Core Erlang. In Proceedings of the PLI'01 Erlang Workshop, Sept. 2001.
[5]
R. Cartwright and M. Fagan. Soft typing. In Proceedings of the SIGPLAN Conference on Programming Language Design and Implementation, pages 278--292. ACM Press, 1991.
[6]
P. Deransart, M. V. Hermenegildo, and J. Maluszyński, editors. Analysis and Visualization Tools for Constraint Programming, Constraint Debugging (DiSCiPl project), volume 1870 of LNCS. Springer, 2000.
[7]
R. B. Findler, J. Clements, C. Flanagan, M. Flatt, S. Krishnamurthi, P. Steckler, and M. Felleisen. DrScheme: A programming environment for Scheme. Journal of Functional Programming, 12(2):159--182, Mar. 2002.
[8]
M. V. Hermenegildo, G. Puebla, F. Bueno, and P. López-García. Integrated program debugging, verification, and optimization using abstract interpretation (and the Ciao system preprocessor). Sci. Comput. Programming, 58(1-2):115--140, 2005.
[9]
T. Lindahl and K. Sagonas. Detecting software defects in telecom applications through lightweight static analysis: A war story. In C. Wei-Ngan, editor, Programming Languages and Systems: Proceedings of the Second Asian Symposium (APLAS'04), volume 3302 of LNCS, pages 91--106. Springer, Nov. 2004.
[10]
S. Marlow and P. Wadler. A practical subtyping system for Erlang. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming, pages 136--149. ACM Press, June 1997.
[11]
S.-O. Nyström. A soft-typing system for Erlang. In Proceedings of ACM SIGPLAN Erlang Workshop, pages 56--71. ACM Press, Aug. 2003.
[12]
A. Wright and R. Cartwright. A practical soft type system for Scheme. ACM Trans. Prog. Lang. Syst., 19(1):87--152, Jan. 1997.

Cited By

View all
  • (2024)Semantic-Type-Guided Bug FindingProceedings of the ACM on Programming Languages10.1145/36897888:OOPSLA2(2183-2210)Online publication date: 8-Oct-2024
  • (2024)Is This Really a Refactoring? Automated Equivalence Checking for Erlang ProjectsProceedings of the 23rd ACM SIGPLAN International Workshop on Erlang10.1145/3677995.3678194(55-66)Online publication date: 28-Aug-2024
  • (2024)Nominal Types for ErlangProceedings of the 23rd ACM SIGPLAN International Workshop on Erlang10.1145/3677995.3678191(24-32)Online publication date: 28-Aug-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
PPDP '06: Proceedings of the 8th ACM SIGPLAN international conference on Principles and practice of declarative programming
July 2006
280 pages
ISBN:1595933883
DOI:10.1145/1140335
  • General Chair:
  • Annalisa Bossi,
  • Program Chair:
  • Michael Maher
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 10 July 2006

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Erlang
  2. constraint-based type inference
  3. subtyping
  4. success typings

Qualifiers

  • Article

Conference

PPDP06
Sponsor:

Acceptance Rates

Overall Acceptance Rate 230 of 486 submissions, 47%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)20
  • Downloads (Last 6 weeks)5
Reflects downloads up to 02 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Semantic-Type-Guided Bug FindingProceedings of the ACM on Programming Languages10.1145/36897888:OOPSLA2(2183-2210)Online publication date: 8-Oct-2024
  • (2024)Is This Really a Refactoring? Automated Equivalence Checking for Erlang ProjectsProceedings of the 23rd ACM SIGPLAN International Workshop on Erlang10.1145/3677995.3678194(55-66)Online publication date: 28-Aug-2024
  • (2024)Nominal Types for ErlangProceedings of the 23rd ACM SIGPLAN International Workshop on Erlang10.1145/3677995.3678191(24-32)Online publication date: 28-Aug-2024
  • (2024)Same Same but Different: A Comparative Analysis of Static Type Checkers in ErlangProceedings of the 23rd ACM SIGPLAN International Workshop on Erlang10.1145/3677995.3678189(2-12)Online publication date: 28-Aug-2024
  • (2024)Ill-Typed Programs Don’t EvaluateProceedings of the ACM on Programming Languages10.1145/36329098:POPL(2010-2040)Online publication date: 5-Jan-2024
  • (2024)Executable contracts for elixirJournal of Logical and Algebraic Methods in Programming10.1016/j.jlamp.2024.101019(101019)Online publication date: Oct-2024
  • (2024)Hybrid Verification of Declarative Programs with Arithmetic Non-fail ConditionsProgramming Languages and Systems10.1007/978-981-97-8943-6_6(109-129)Online publication date: 23-Oct-2024
  • (2024)Inferring Non-failure Conditions for Declarative ProgramsFunctional and Logic Programming10.1007/978-981-97-2300-3_10(167-187)Online publication date: 15-May-2024
  • (2023)Special Delivery: Programming with Mailbox TypesProceedings of the ACM on Programming Languages10.1145/36078327:ICFP(78-107)Online publication date: 31-Aug-2023
  • (2023)ElixirST: A session-based type system for Elixir modulesJournal of Logical and Algebraic Methods in Programming10.1016/j.jlamp.2023.100891135(100891)Online publication date: Oct-2023
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media