Skip to main content

Using Static Analysis to Detect Type Errors and Concurrency Defects in Erlang Programs

  • Conference paper
Functional and Logic Programming (FLOPS 2010)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 6009))

Included in the following conference series:

Abstract

This invited talk will present the key ideas in the design and implementation of Dialyzer, a static analysis tool for Erlang programs. Dialyzer started as a defect detection tool using a rather ad hoc dataflow analysis to detect type errors in Erlang programs, but relatively early in its development it adopted a more disciplined approach to detecting definite type clashes in dynamically typed languages. Namely, an approach based on using a constraint-based analysis to infer success typings which are also enhanced with optional contracts supplied by the programmer.

In the first part of the talk, we will describe this constraint-based approach to type inference and explain how it differs with past and recent attempts to type check programs written in dynamic languages. In the second part of the talk, we will present important recent additions to Dialyzer, namely analyses that detect concurrency defects (such as race conditions) in Erlang programs. For a number of years now, Dialyzer has been part of the Erlang/OTP system and has been actively used by its community. Based on this experience, we will also critically examine Dialyzer’s design choices, show interesting cases of Dialyzer’s use, and distill the main lessons learned from using static analysis in open source as well as commercial code bases of significant size.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Armstrong, J.: Programming Erlang: Software for a Concurrent World. The Pragmatic Bookshelf, Raleigh (2007)

    Google Scholar 

  2. Nagy, T., Nagyné Víg, A.: Erlang testing and tools survey. In: Proceedings of the 7th ACM SIGPLAN Workshop on Erlang, pp. 21–28. ACM, New York (2008)

    Chapter  Google Scholar 

  3. Lindahl, T., Sagonas, K.: Detecting software defects in telecom applications through lightweight static analysis: A war story. In: Wei-Ngan, C. (ed.) APLAS 2004. LNCS, vol. 3302, pp. 91–106. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  4. Lindahl, T., Sagonas, K.: Practical type inference based on success typings. In: Proceedings of the 8th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming, pp. 167–178. ACM, New York (2006)

    Google Scholar 

  5. Christakis, M., Sagonas, K.: Static detection of race conditions in Erlang. In: Carro, M., Peña, R. (eds.) PADL 2010. LNCS, vol. 5937, pp. 119–133. Springer, Heidelberg (2010)

    Google Scholar 

  6. Sagonas, K.: Experience from developing the Dialyzer: A static analysis tool detecting defects in Erlang applications. In: Proceedings of the ACM SIGPLAN Workshop on the Evaluation of Software Defect Detection Tools (2005)

    Google Scholar 

  7. Marlow, S., Wadler, P.: A practical subtyping system for Erlang. In: Proceedings of the ACM SIGPLAN International Conference on Functional Programming, pp. 136–149. ACM, New York (1997)

    Chapter  Google Scholar 

  8. Nyström, S.O.: A soft-typing system for Erlang. In: Proceedings of ACM SIGPLAN Erlang Workshop, pp. 56–71. ACM, New York (2003)

    Google Scholar 

  9. Jimenez, M., Lindahl, T., Sagonas, K.: A language for specifying type contracts in Erlang and its interaction with success typings. In: Proceedings of the 6th ACM SIGPLAN Workshop on Erlang, pp. 11–17. ACM, New York (2007)

    Google Scholar 

  10. Findler, R.B., Clements, J., Flanagan, C., Flatt, M., Krishnamurthi, S., Steckler, P., Felleisen, M.: DrScheme: A programming environment for Scheme. Journal of Functional Programming 12(2), 159–182 (2002)

    Article  MATH  Google Scholar 

  11. Sagonas, K., Luna, D.: Gradual typing of Erlang programs: A Wrangler experience. In: Proceedings of the 7th ACM SIGPLAN Workshop on Erlang, pp. 73–82. ACM, New York (2008)

    Chapter  Google Scholar 

Download references

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Sagonas, K. (2010). Using Static Analysis to Detect Type Errors and Concurrency Defects in Erlang Programs. In: Blume, M., Kobayashi, N., Vidal, G. (eds) Functional and Logic Programming. FLOPS 2010. Lecture Notes in Computer Science, vol 6009. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-12251-4_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-12251-4_2

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-12250-7

  • Online ISBN: 978-3-642-12251-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics