Skip to main content

Lightweight Polymorphic Effects

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 7313))

Abstract

Type-and-effect systems are a well-studied approach for reasoning about the computational behavior of programs. Nevertheless, there is only one example of an effect system that has been adopted in a wide-spread industrial language: Java’s checked exceptions. We believe that the main obstacle to using effect systems in day-to-day programming is their verbosity, especially when writing functions that are polymorphic in the effect of their argument. To overcome this issue, we propose a new syntactically lightweight technique for writing effect-polymorphic functions. We show its independence from a specific kind of side-effect by embedding it into a generic and extensible framework for checking effects of multiple domains. Finally, we verify the expressiveness and practicality of the system by implementing it for the Scala programming language.

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

Buying options

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

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Abadi, M., Birrell, A., Harris, T., Isard, M.: Semantics of transactional memory and automatic mutual exclusion. In: Proceedings of the 35th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2008, pp. 63–74. ACM, New York (2008)

    Chapter  Google Scholar 

  2. Bocchino Jr., R.L., Adve, V.S.: Types, Regions, and Effects for Safe Programming with Object-Oriented Parallel Frameworks. In: Mezini, M. (ed.) ECOOP 2011. LNCS, vol. 6813, pp. 306–332. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  3. Bracha, G.: Pluggable type systems. In: OOPSLA 2004 Workshop on Revival of Dynamic Languages (2004)

    Google Scholar 

  4. Foster, J.S., Johnson, R., Kodumal, J., Aiken, A.: Flow-insensitive type qualifiers. ACM Trans. Program. Lang. Syst. 28, 1035–1087 (2006)

    Article  Google Scholar 

  5. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design patterns: elements of reusable object-oriented software. Addison-Wesley Longman Publishing Co., Inc., Boston (1995)

    Google Scholar 

  6. Gibbons, J., Oliveira, B.C.D.S.: The essence of the iterator pattern. In: McBride, C., Uustalu, T. (eds.) Mathematically-Structured Functional Programming (2006)

    Google Scholar 

  7. Gifford, D.K., Jouvelot, P., Sheldon, M.A., O’Toole, J.W.: Report on the FX programming language. Technical report (1992)

    Google Scholar 

  8. Gosling, J., Joy, B., Steele, G., Bracha, G.: The Java(TM) Language Specification, 3rd edn. Addison-Wesley Professional (2005)

    Google Scholar 

  9. Haller, P., Odersky, M.: Scala actors: Unifying thread-based and event-based programming. Theor. Comput. Sci. 410(2-3), 202–220 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  10. Hejlsberg, A.: The trouble with checked exceptions (2003), http://www.artima.com/intv/handcuffs.html

  11. King, D., Wadler, P.: Combining monads. In: Mathematical Structures in Computer Science, pp. 61–78 (1992)

    Google Scholar 

  12. Lea, D.: A Java fork/join framework. In: Java Grande, pp. 36–43 (2000)

    Google Scholar 

  13. Lucassen, J.M., Gifford, D.K.: Polymorphic effect systems. In: Proceedings of the 15th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 1988, pp. 47–57. ACM, New York (1988)

    Chapter  Google Scholar 

  14. Marino, D., Millstein, T.: A generic type-and-effect system. In: Proceedings of the 4th International Workshop on Types in Language Design and Implementation, TLDI 2009, pp. 39–50. ACM, New York (2009)

    Google Scholar 

  15. Mikhailova, A., Romanovsky, A.: Supporting evolution of interface exceptions, pp. 94–110. Springer-Verlag New York, Inc., New York (2001)

    Google Scholar 

  16. Odersky, M.: The Scala language specification (2011), http://www.scala-lang.org/docu/files/ScalaReference.pdf

  17. Odersky, M., Moors, A.: Fighting bit rot with types (experience report: Scala collections). In: Kannan, R., Narayan Kumar, K. (eds.) IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science (FSTTCS 2009). Leibniz International Proceedings in Informatics (LIPIcs), vol. 4, pp. 427–451. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, Dagstuhl (2009)

    Google Scholar 

  18. Pearce, D.J.: JPure: A Modular Purity System for Java. In: Knoop, J. (ed.) CC 2011. LNCS, vol. 6601, pp. 104–123. Springer, Heidelberg (2011), doi:10.1007/978-3-642-19861-8_7

    Chapter  Google Scholar 

  19. Rytz, L., Odersky, M.: Lightweight polymorphic effects - proofs. Technical report, EPFL (2012)

    Google Scholar 

  20. Syme, D., Petricek, T., Lomov, D.: The F# Asynchronous Programming Model. In: Rocha, R., Launchbury, J. (eds.) PADL 2011. LNCS, vol. 6539, pp. 175–189. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  21. Talpin, J.-P., Jouvelot, P.: Polymorphic type, region and effect inference. Journal of Functional Programming 2(3), 245–271 (1992)

    Article  MathSciNet  MATH  Google Scholar 

  22. van Dooren, M., Steegmans, E.: Combining the robustness of checked exceptions with the flexibility of unchecked exceptions using anchored exception declarations. In: Proceedings of the 20th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2005, pp. 455–471. ACM, New York (2005)

    Chapter  Google Scholar 

  23. Wadler, P., Thiemann, P.: The marriage of effects and monads. ACM Trans. Comput. Logic 4, 1–32 (2003)

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Rytz, L., Odersky, M., Haller, P. (2012). Lightweight Polymorphic Effects. In: Noble, J. (eds) ECOOP 2012 – Object-Oriented Programming. ECOOP 2012. Lecture Notes in Computer Science, vol 7313. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-31057-7_13

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-31057-7_13

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-31056-0

  • Online ISBN: 978-3-642-31057-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics