Skip to main content

Spores: A Type-Based Foundation for Closures in the Age of Concurrency and Distribution

  • Conference paper
ECOOP 2014 – Object-Oriented Programming (ECOOP 2014)

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

Included in the following conference series:

Abstract

Functional programming (FP) is regularly touted as the way forward for bringing parallel, concurrent, and distributed programming to the mainstream. The popularity of the rationale behind this viewpoint has even led to a number of object-oriented (OO) programming languages outside the Smalltalk tradition adopting functional features such as lambdas and thereby function closures. However, despite this established viewpoint of FP as an enabler, reliably distributing function closures over a network, or using them in concurrent environments nonetheless remains a challenge across FP and OO languages. This paper takes a step towards more principled distributed and concurrent programming by introducing a new closure-like abstraction and type system, called spores, that can guarantee closures to be serializable, thread-safe, or even have custom user-defined properties. Crucially, our system is based on the principle of encoding type information corresponding to captured variables in the type of a spore. We prove our type system sound, implement our approach for Scala, evaluate its practicality through a small empirical study, and show the power of these guarantees through a case analysis of real-world distributed and concurrent frameworks that this safe foundation for closures facilitates.

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. Budimlić, Z., Burke, M., Cavé, V., Knobe, K., Lowney, G., Newton, R., Palsberg, J., Peixotto, D., Sarkar, V., Schlimbach, F.: et al. Concurrent collections. Scientific Programming 18(3) (2010)

    Google Scholar 

  2. Chakravarty, M.M.T., Leshchinskiy, R., Peyton Jones, S., Keller, G., Marlow, S.: Data Parallel Haskell: A status report. In: Proc. DAMP Workshop, pp. 10–18. ACM (2007)

    Google Scholar 

  3. Collins, A., Grewe, D., Grover, V., Lee, S., Susnea, A.: NOVA: A functional language for data parallelism. Technical Report NVR-2013-002, NVIDIA Corporation (July 2013)

    Google Scholar 

  4. Dean, J., Ghemawat, S.: Mapreduce: Simplified data processing on large clusters. Commun. ACM 51(1), 107–113 (2008)

    Article  Google Scholar 

  5. Epstein, J., Black, A.P., Peyton-Jones, S.: Towards Haskell in the cloud. In: Proc. Haskell Symposium, pp. 118–129. ACM (2011)

    Google Scholar 

  6. Germain, G.: Concurrency oriented programming in Termite Scheme. In: Erlang Workshop, p. 20. ACM (2006)

    Google Scholar 

  7. Goetz, B.: JSR 335: Lambda expressions for the Java programming language (2013), https://jcp.org/en/jsr/detail?id=335

  8. Herhut, S., Hudson, R.L., Shpeisman, T., Sreeram, J.: River trail: a path to parallelism in JavaScript. In: OOPSLA, pp. 729–744 (2013)

    Google Scholar 

  9. International Standard ISO/IEC 14882:2011. Programming Languages – C++. International Organization for Standards (2011)

    Google Scholar 

  10. Lewis, J.R., Launchbury, J., Meijer, E., Shields, M.: Implicit parameters: Dynamic scoping with static types. In: POPL, pp. 108–118 (2000)

    Google Scholar 

  11. Maier, P., Trinder, P.: Implementing a high-level distributed-memory parallel Haskell in Haskell. In: Gill, A., Hage, J. (eds.) IFL 2011. LNCS, vol. 7257, pp. 35–50. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  12. Marlow, S., Newton, R., Peyton Jones, S.: A monad for deterministic parallelism. In: Proc. Haskell Symposium, pp. 71–82. ACM (2011)

    Google Scholar 

  13. Matsakis, N.: Fn types in Rust, take 3 (2013), http://smallcultfollowing.com/babysteps/blog/2013/10/10/fn-types-in-rust

  14. Matsakis, N.D.: Parallel closures: a new twist on an old idea. In: HotPar. USENIX (2012)

    Google Scholar 

  15. McKerns, M.M., Strand, L., Sullivan, T., Fang, A., Aivazis, M.A.: Building a framework for predictive science. In: Proc. of the 10th Python in Science Conf. (2011)

    Google Scholar 

  16. Meijer, E.: Confessions of a used programming language salesman. In: OOPSLA (2007)

    Google Scholar 

  17. Meyerovich, L.A., Rabkin, A.S.: Empirical analysis of programming language adoption. In: OOPSLA (2013)

    Google Scholar 

  18. Miller, H., Haller, P.: Spores, formally. Technical Report EPFL-REPORT-191240, Department of Computer Science, EPFL, Lausanne, Switzerland (December 2013)

    Google Scholar 

  19. Miller, H., Haller, P., Burmako, E., Odersky, M.: Instant pickles: Generating object-oriented pickler combinators for fast and extensible serialization. In: OOPSLA, pp. 183–202 (2013)

    Google Scholar 

  20. Miller, H., Haller, P., Rytz, L., Odersky, M.: Functional programming for all! Scaling a MOOC for students and professionals alike. In: ICSE, pp. 265–263 (2014)

    Google Scholar 

  21. Morrisett, J.G., Walker, D., Crary, K., Glew, N.: From system F to typed assembly language. ACM Trans. Program. Lang. Syst 21(3), 527–568 (1999)

    Article  Google Scholar 

  22. Murphy VII, T., Crary, K., Harper, R.: Type-safe distributed programming with ML5. In: Barthe, G., Fournet, C. (eds.) TGC 2007. LNCS, vol. 4912, pp. 108–123. Springer, Heidelberg (2008)

    Google Scholar 

  23. Odersky, M.: The Scala language specification (2013)

    Google Scholar 

  24. Pierce, B.C.: Types and programming languages. MIT Press (2002)

    Google Scholar 

  25. Prokopec, A., Bagwell, P., Rompf, T., Odersky, M.: A generic parallel collection framework. In: Jeannot, E., Namyst, R., Roman, J. (eds.) Euro-Par 2011, Part II. LNCS, vol. 6853, pp. 136–147. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  26. Prokopec, A., Miller, H., Schlatter, T., Haller, P., Odersky, M.: FlowPools: A lock-free deterministic concurrent dataflow abstraction. In: Kasahara, H., Kimura, K. (eds.) LCPC 2012. LNCS, vol. 7760, pp. 158–173. Springer, Heidelberg (2013)

    Chapter  Google Scholar 

  27. Rompf, T., Maier, I., Odersky, M.: Implementing first-class polymorphic delimited continuations by a type-directed selective CPS-transform. In: ICFP, pp. 317–328. ACM (2009)

    Google Scholar 

  28. Schwendner, A.: Distributed functional programming in Scheme. Master’s thesis, Massachusetts Institute of Technology (2009)

    Google Scholar 

  29. Typesafe. Akka (2009), http://akka.io/

  30. Wright, A.K., Felleisen, M.: A syntactic approach to type soundness. Inf. Comput. 115(1), 38–94 (1994)

    Article  MATH  MathSciNet  Google Scholar 

  31. Zaharia, M., Chowdhury, M., Das, T., Dave, A., McCauley, M., Franklin, M., Shenker, S., Stoica, I.: Resilient distributed datasets: A fault-tolerant abstraction for in-memory cluster computing. In: NSDI. USENIX (2012)

    Google Scholar 

  32. Zibin, Y., Potanin, A., Li, P., Ali, M., Ernst, M.D.: Ownership and immutability in generic java. In: OOPSLA, pp. 598–617. ACM (2010)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Miller, H., Haller, P., Odersky, M. (2014). Spores: A Type-Based Foundation for Closures in the Age of Concurrency and Distribution. In: Jones, R. (eds) ECOOP 2014 – Object-Oriented Programming. ECOOP 2014. Lecture Notes in Computer Science, vol 8586. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-44202-9_13

Download citation

  • DOI: https://doi.org/10.1007/978-3-662-44202-9_13

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-662-44201-2

  • Online ISBN: 978-3-662-44202-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics