Abstract
Despite their obvious advantages in terms of static reasoning, the adoption of effect systems is still rather limited in practice. Recent advances such as generic effect systems, lightweight effect polymorphism, and gradual effect checking, all represent promising steps towards making effect systems suitable for widespread use. However, no existing system combines these approaches: the theory of gradual polymorphic effects has not been developed, and there are no implementations of gradual effect checking. In addition, a limiting factor in the adoption of effect systems is their unsuitability for localized and customized effect disciplines. This paper addresses these issues by presenting the first implementation of gradual effect checking, for Scala, which supports both effect polymorphism and a domain-specific language called Effscript to declaratively define and customize effect disciplines. We report on the theory, implementation, and practical application of the system.
Supplemental Material
Available for Download
EffScript is a small domain-specific language for writing tailored effect disciplines for Scala. In addition to being customizable, the underlying effect system supports both effect polymorphism (as developed by Lukas Rytz in his PhD thesis) and gradual effect checking (following the theory of Ba ñados, Garcia and Tanter). Please refer to http://pleiad.cl/research/software/effscript for detailed information.
- M. Abadi, A. Birrell, T. Harris, and M. Isard. Semantics of transactional memory and automatic mutual exclusion. In Proceedings of the 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2008), pages 63–74, San Francisco, CA, USA, Jan. 2008. ACM Press. Google Scholar
Digital Library
- M. Abadi, C. Flanagan, and S. N. Freund. Types for safe locking: Static race detection for Java. ACM Transactions on Programming Languages and Systems, 28(2):207–255, 2006. Google Scholar
Digital Library
- A. Ahmed, R. B. Findler, J. G. Siek, and P. Wadler. Blame for all. In Proceedings of the 38th annual ACM SIGPLANSIGACT symposium on Principles of programming languages (POPL 2011), pages 201–214, Austin, Texas, USA, Jan. 2011. Google Scholar
Digital Library
- ACM Press.Google Scholar
- C. Andreae, J. Noble, S. Markstrum, and T. Millstein. A framework for implementing pluggable type systems. In Proceedings of the 21st ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2006), pages 57–74, Portland, Oregon, USA, Oct. 2006. ACM Press. ACM SIGPLAN Notices, 41(10). Google Scholar
Digital Library
- F. Ba˜nados, R. Garcia, and É. Tanter. A theory of gradual effect systems. In Proceedings of the 19th ACM SIGPLAN Conference on Functional Programming (ICFP 2014), pages 283–295, Gothenburg, Sweden, Sept. 2014. ACM Press. Google Scholar
Digital Library
- N. Benton and P. Buchlovsky. Semantics of an effect analysis for exceptions. In Proceedings of the 2007 ACM SIGPLAN International Workshop on Types in Languages Design and Implementation (TLDI 2007), pages 15–26. ACM, 2007. Google Scholar
Digital Library
- G. M. Bierman, M. Abadi, and M. Torgersen. Understanding TypeScript. In R. Jones, editor, Proceedings of the 28th European Conference on Object-oriented Programming (ECOOP 2014), volume 8586 of Lecture Notes in Computer Science, pages 257–281, Uppsala, Sweden, July 2014. Springer-Verlag.Google Scholar
Digital Library
- G. Bracha. Pluggable type systems. In Workshop on Revival of Dynamic Languages, 2004.Google Scholar
- P. Cousot and R. Cousot. Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Conference Record of the 4th ACM Symposium on Principles of Programming Languages (POPL 77), pages 238–252, Los Angeles, CA, USA, Jan. 1977. ACM Press. Google Scholar
Digital Library
- D. S. Dantas, D. Walker, G. Washburn, and S. Weirich. AspectML: A polymorphic aspect-oriented functional programming language. ACM Transactions on Programming Languages and Systems, 30(3):Article No. 14, May 2008. Google Scholar
Digital Library
- W. Dietl, S. Dietzel, M. D. Ernst, K. Muslu, and T. W. Schiller. Building and using pluggable type-checkers. In Proceedings of the 33rd International Conference on Software Engineering (ICSE 2011), pages 681–690, Hawaii, USA, May 2011. ACM Press. Google Scholar
Digital Library
- T. Disney and C. Flanagan. Gradual information flow typing. In International Workshop on Scripts to Programs, 2011.Google Scholar
- C. Dutchyn, D. B. Tucker, and S. Krishnamurthi. Semantics and scoping of aspects in higher-order languages. Science of Computer Programming, 63(3):207–239, Dec. 2006. Google Scholar
Digital Library
- J. Fabry, T. Dinkelaker, J. Noyé, and É. Tanter. A taxonomy of domain-specific aspect languages. ACM Computing Surveys, 47(3):40:1–40:44, Apr. 2015. Google Scholar
Digital Library
- L. Fennell and P. Thiemann. Gradual security typing with references. In Proceedings of the 26th Computer Security Foundations Symposium (CSF), pages 224–239, June 2013. Google Scholar
Digital Library
- R. Garcia, É. Tanter, R. Wolff, and J. Aldrich. Foundations of typestate-oriented programming. ACM Transactions on Programming Languages and Systems, 36(4):12:1–12:44, Oct. 2014. Google Scholar
Digital Library
- D. K. Gifford and J. M. Lucassen. Integrating functional and imperative programming. In Proceedings of the ACM Conference on LISP and Functional Programming (LFP ’86), pages 28–38, 1986. Google Scholar
Digital Library
- C. S. Gordon, W. Dietl, M. D. Ernst, and D. Grossman. Java U I : Effects for controlling UI object access. In G. Castagna, editor, Proceedings of the 27th European Conference on Object-oriented Programming (ECOOP 2013), volume 7920 of Lecture Notes in Computer Science, pages 179–204, Montpellier, France, July 2013. Springer-Verlag. Google Scholar
Digital Library
- J. Gosling, B. Joy, G. Steele, and G. Bracha. The Java Language Specification, Third Edition. Addison-Wesley, 2003. Google Scholar
Digital Library
- A. Igarashi, B. C. Pierce, and P. Wadler. Featherweight Java: a minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems, 23(3):396–450, 2001. Google Scholar
Digital Library
- G. Kiczales, J. des Rivières, and D. G. Bobrow. The Art of the Metaobject Protocol. MIT Press, 1991. Google Scholar
Digital Library
- G. Kiczales, E. Hilsdale, J. Hugunin, M. Kersten, J. Palm, and W. Griswold. An overview of AspectJ. In J. L. Knudsen, editor, Proceedings of the 15th European Conference on Object-Oriented Programming (ECOOP 2001), number 2072 in Lecture Notes in Computer Science, pages 327–353, Budapest, Hungary, June 2001. Springer-Verlag. Google Scholar
Digital Library
- G. Kiczales, J. Lamping, C. V. Lopes, C. Maeda, A. Mendhekar, and G. Murphy. Open implementation design guidelines. In Proceedings of the 19th International Conference on Software Engineering (ICSE 97), pages 481–490, Boston, Massachusetts, USA, 1997. ACM Press. Google Scholar
Digital Library
- G. Kiczales, J. Lamping, A. Mendhekar, C. Maeda, C. V. Lopes, J.-M. Loingtier, and J. Irwin. Aspect-oriented programming. In M. Aks¸it and S. Matsuoka, editors, Proceedings of the 11th European Conference on Object-Oriented Programming (ECOOP 97), volume 1241 of Lecture Notes in Computer Science, pages 220–242, Jyväskylä, Finland, June 1997. Springer-Verlag.Google Scholar
Cross Ref
- J. Lamping, G. Kiczales, L. H. R. Jr., and E. Ruf. An architecture for an open compiler. In Proceedings of the IMSA 92 Workshop on Reflection and Meta-Level Architectures, pages 95–106. Akinori Yonezawa and Brian C. Smith, editors, 1992.Google Scholar
- D. Leijen. Koka: Programming with row polymorphic effect types. In Mathematically Structured Functional Programming. Electronic Proceedings in Theoretical Computer Science, Mar. 2014.Google Scholar
Cross Ref
- D. Marino and T. Millstein. A generic type-and-effect system. In Proceedings of the ACM SIGPLAN International Workshop on Types in Language Design and Implementation, pages 39– 50, 2009. Google Scholar
Digital Library
- J. Matthews and A. Ahmed. Parametric polymorphism through run-time sealing, or, theorems for low, low prices! In S. Drossopoulou, editor, Proceedings of the 17th European Symposium on Programming Languages and Systems (ESOP 2008), volume 4960 of Lecture Notes in Computer Science, pages 16–31, Budapest, Hungary, 2008. Springer-Verlag. Google Scholar
Digital Library
- B. C. Pierce and D. N. Turner. Local type inference. ACM Trans. Program. Lang. Syst., 22(1):1–44, Jan. 2000. Google Scholar
Digital Library
- L. Rytz. A Practical Effect System for Scala. PhD thesis, École Polytechnique Fédérale de Lausanne, Sept. 2013.Google Scholar
- L. Rytz, N. Amin, and M. Odersky. A flow-insensitive, modular effect system for purity. In Proceedings of the Workshop on Formal Techniques for Java-like Programs, 2013. Article No.: 4. Google Scholar
Digital Library
- L. Rytz, M. Odersky, and P. Haller. Lightweight polymorphic effects. In J. Noble, editor, Proceedings of the 26th European Conference on Object-oriented Programming (ECOOP 2012), volume 7313 of Lecture Notes in Computer Science, pages 258–282, Beijing, China, June 2012. Springer-Verlag. Google Scholar
Digital Library
- I. Sergey and D. Clarke. Gradual ownership types. In H. Seidl, editor, Proceedings of the 21st European Symposium on Programming Languages and Systems (ESOP 2012), volume 7211 of Lecture Notes in Computer Science, pages 579– 599, Tallinn, Estonia, 2012. Springer-Verlag. Google Scholar
Digital Library
- J. Siek and W. Taha. Gradual typing for functional languages. In Proceedings of the Scheme and Functional Programming Workshop, pages 81–92, Sept. 2006.Google Scholar
- P. Thiemann and L. Fennell. Gradual typing for annotated type systems. In Z. Shao, editor, Proceedings of the 23rd European Symposium on Programming Languages and Systems (ESOP 2014), volume 8410 of Lecture Notes in Computer Science, pages 47–66, Grenoble, France, 2014. Springer-Verlag.Google Scholar
- R. Toledo, P. Leger, and É. Tanter. AspectScript: Expressive aspects for the Web. In Proceedings of the 9th ACM International Conference on Aspect-Oriented Software Development (AOSD 2010), pages 13–24, Rennes and Saint Malo, France, Mar. 2010. ACM Press. Google Scholar
Digital Library
- M. Toro and É. Tanter. Gradual polymorphic effects— complete definition and soundness proof. Technical Report TR/DCC-2015-2, University of Chile, July 2015.Google Scholar
- Typesafe Inc. Slick functional relational mapping for Scala. http://slick.typesafe.com/.Google Scholar
- Typesafe, Inc. Play framework, 2007. http://www. playframework.com/.Google Scholar
Index Terms
Customizable gradual polymorphic effects for Scala
Recommendations
Customizable gradual polymorphic effects for Scala
OOPSLA 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and ApplicationsDespite their obvious advantages in terms of static reasoning, the adoption of effect systems is still rather limited in practice. Recent advances such as generic effect systems, lightweight effect polymorphism, and gradual effect checking, all ...
On polymorphic gradual typing
We study an extension of gradual typing—a method to integrate dynamic typing and static typing smoothly in a single language—to parametric polymorphism and its theoretical properties, including conservativity of typing and semantics over both statically ...
A theory of gradual effect systems
ICFP '14: Proceedings of the 19th ACM SIGPLAN international conference on Functional programmingEffect systems have the potential to help software developers, but their practical adoption has been very limited. We conjecture that this limited adoption is due in part to the difficulty of transitioning from a system where effects are implicit and ...






Comments