Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

Customizable gradual polymorphic effects for Scala

Published: 23 October 2015 Publication History

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.

Supplementary Material

Auxiliary Archive (p935-toro-s.zip)
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.

References

[1]
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.
[2]
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.
[3]
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.
[4]
ACM Press.
[5]
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).
[6]
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.
[7]
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.
[8]
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.
[9]
G. Bracha. Pluggable type systems. In Workshop on Revival of Dynamic Languages, 2004.
[10]
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.
[11]
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.
[12]
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.
[13]
T. Disney and C. Flanagan. Gradual information flow typing. In International Workshop on Scripts to Programs, 2011.
[14]
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.
[15]
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.
[16]
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.
[17]
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.
[18]
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.
[19]
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.
[20]
J. Gosling, B. Joy, G. Steele, and G. Bracha. The Java Language Specification, Third Edition. Addison-Wesley, 2003.
[21]
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.
[22]
G. Kiczales, J. des Rivières, and D. G. Bobrow. The Art of the Metaobject Protocol. MIT Press, 1991.
[23]
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.
[24]
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.
[25]
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.
[26]
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.
[27]
D. Leijen. Koka: Programming with row polymorphic effect types. In Mathematically Structured Functional Programming. Electronic Proceedings in Theoretical Computer Science, Mar. 2014.
[28]
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.
[29]
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.
[30]
B. C. Pierce and D. N. Turner. Local type inference. ACM Trans. Program. Lang. Syst., 22(1):1–44, Jan. 2000.
[31]
L. Rytz. A Practical Effect System for Scala. PhD thesis, École Polytechnique Fédérale de Lausanne, Sept. 2013.
[32]
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.
[33]
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.
[34]
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.
[35]
J. Siek and W. Taha. Gradual typing for functional languages. In Proceedings of the Scheme and Functional Programming Workshop, pages 81–92, Sept. 2006.
[36]
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.
[37]
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.
[38]
M. Toro and É. Tanter. Gradual polymorphic effects— complete definition and soundness proof. Technical Report TR/DCC-2015-2, University of Chile, July 2015.
[39]
Typesafe Inc. Slick functional relational mapping for Scala. http://slick.typesafe.com/.
[40]
Typesafe, Inc. Play framework, 2007. http://www. playframework.com/.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 50, Issue 10
OOPSLA '15
October 2015
953 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/2858965
  • Editor:
  • Andy Gill
Issue’s Table of Contents
  • cover image ACM Conferences
    OOPSLA 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications
    October 2015
    953 pages
    ISBN:9781450336895
    DOI:10.1145/2814270
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 23 October 2015
Published in SIGPLAN Volume 50, Issue 10

Check for updates

Author Tags

  1. Scala
  2. Type-and-effect systems
  3. effect polymorphism
  4. effscript
  5. gradual typing

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)6
  • Downloads (Last 6 weeks)0
Reflects downloads up to 21 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2021)Polymorphic Iterable Sequential Effect SystemsACM Transactions on Programming Languages and Systems10.1145/345027243:1(1-79)Online publication date: Apr-2021
  • (2020)Polymorphic types and effects with Boolean unificationProceedings of the ACM on Programming Languages10.1145/34282224:OOPSLA(1-29)Online publication date: 13-Nov-2020
  • (2023)Error Localization for Sequential Effect SystemsStatic Analysis10.1007/978-3-031-44245-2_16(343-370)Online publication date: 22-Oct-2023
  • (2019)Bidirectional type checking for relational propertiesProceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3314221.3314603(533-547)Online publication date: 8-Jun-2019
  • (2018)JEff: objects for effectProceedings of the 2018 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software10.1145/3276954.3276955(111-124)Online publication date: 24-Oct-2018
  • (2018)Type-Driven Gradual Security with ReferencesACM Transactions on Programming Languages and Systems10.1145/322906140:4(1-55)Online publication date: 13-Dec-2018
  • (2016)First-class effect reflection for effect-guided programmingACM SIGPLAN Notices10.1145/3022671.298403751:10(820-837)Online publication date: 19-Oct-2016
  • (2016)Side effects take the blameProceedings of the 2016 ACM SIGPLAN International Conference on Software Language Engineering10.1145/2997364.2997381(195-206)Online publication date: 20-Oct-2016
  • (2016)First-class effect reflection for effect-guided programmingProceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications10.1145/2983990.2984037(820-837)Online publication date: 19-Oct-2016
  • (2016)Gradual type-and-effect systemsJournal of Functional Programming10.1017/S095679681600016226Online publication date: 22-Sep-2016

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media