Motivated by a concrete goal, namely to extend Erlang with the ability to employ user-defined guards, we developed a parameterized static analysis tool called Purity, that classifies functions as referentially transparent (i.e., side-effect free with no dependency on the execution environment and never raising an exception), side-effect free with no dependencies but possibly raising exceptions, or side-effect free but with possible dependencies and possibly raising exceptions. We have applied Purity on a large corpus of Erlang code bases and report experimental results showing the percentage of functions that the analysis definitely classifies in each category. Moreover, we discuss how our analysis has been incorporated on a development branch of the Erlang/OTP compiler in order to allow extending the language with user-defined guards.


Pattern Match Execution Environment Functional Language Impure Function Purity Level 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Agha, G.: Actors: A Model of Concurrent Computation in Distributed Systems. MIT Press, Cambridge (1986)Google Scholar
  2. 2.
    Barklund, J., Virding, R.: Erlang 4.7.3 reference manual (February 1999),
  3. 3.
    Carlsson, R., Gustavsson, B., Johansson, E., Lindgren, T., Nyström, S.O., Pettersson, M., Virding, R.: Core Erlang 1.0 language specification. Tech. Rep. 030, Information Technology Department, Uppsala University (November 2000)Google Scholar
  4. 4.
    Carlsson, R., Gustavsson, B., Nyblom, P.: Erlangs exception handling revisited. In: Proceedings of the ACM SIGPLAN Workshop on Erlang, pp. 16–26. ACM (2004)Google Scholar
  5. 5.
    Ericsson, A.B.: Erlang Reference Manual Users Guide, version 5.8 (June 2010),
  6. 6.
    Lucassen, J.M., Gifford, D.K.: Polymorphic effect systems. In: Conference Record of the Fifteenth Annual ACM Symposium on Principles of Programming Languages, pp. 47–57. ACM, New York (January 1988)Google Scholar
  7. 7.
    Newbern, J.: All about monads,
  8. 8.
    Pierce, B.C. (ed.): Advanced Topics in Types and Programming Languages. MIT Press, Cambridge (2005)zbMATHGoogle Scholar
  9. 9.
    Plasmeijer, R., van Eekelen, M.: Clean Language Report, version 2.1 (November 2002),
  10. 10.
    Shapiro, J., Sridhar, S., Doerrie, M.S.: The origins of the BitC programming language (April 2008),
  11. 11.
    de Vries, E., Plasmeijer, R., Abrahamson, D.M.: Uniqueness typing simplified. In: Chitil, O., Horváth, Z., Zsók, V. (eds.) IFL 2007. LNCS, vol. 5083, pp. 201–218. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  12. 12.
    Wadler, P.: The marriage of effects and monads. ACM SIGPLAN Notices 34(1), 63–74 (1999)MathSciNetCrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Mihalis Pitidis
    • 1
  • Konstantinos Sagonas
    • 1
    • 2
  1. 1.School of Electrical and Computer EngineeringNational Technical University of AthensGreece
  2. 2.Department of Information TechnologyUppsala UniversitySweden

Personalised recommendations