skip to main content
research-article

First-class effect reflection for effect-guided programming

Published:19 October 2016Publication History
Skip Abstract Section

Abstract

This paper introduces a novel type-and-effect calculus, first-class effects, where the computational effect of an expression can be programmatically reflected, passed around as values, and analyzed at run time. A broad range of designs "hard-coded" in existing effect-guided analyses — from thread scheduling, version-consistent software updating, to data zeroing — can be naturally supported through the programming abstractions. The core technical development is a type system with a number of features, including a hybrid type system that integrates static and dynamic effect analyses, a refinement type system to verify application-specific effect management properties, a double-bounded type system that computes both over-approximation of effects and their under-approximation. We introduce and establish a notion of soundness called trace consistency, defined in terms of how the effect and trace correspond. The property sheds foundational insight on "good" first-class effect programming.

References

  1. M. Abadi, L. Cardelli, B. Pierce, and G. Plotkin. Dynamic typing in a statically-typed language. In Proceedings of the Symposium on Principles of Programming Languages, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. F. Bañados Schwerter, R. Garcia, and E. Tanter. A theory of gradual effect systems. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. Bagherzadeh and H. Rajan. Panini: A concurrent programming model for solving pervasive and oblivious interference. In the International Conference on Modularity, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. A. Bauer and M. Pretnar. Programming with algebraic effects and handlers. CoRR, 2012.Google ScholarGoogle Scholar
  5. E. Bertino, S. Jajodia, and P. Samarati. Supporting multiple access control policies in database systems. In Proceedings of the IEEE Symposium on Security and Privacy, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. R. L. Bocchino and V. S. Adve. Types, regions, and effects for safe programming with object-oriented parallel frameworks. In Proceedings of the 25th European Conference on Objectoriented Programming, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. P. Boström and P. Müller. Modular verification of finite blocking in non-terminating programs. In Proceedings of the European Conference on Object-oriented Programming, 2015.Google ScholarGoogle Scholar
  8. S. Burckhardt, A. Baldassin, and D. Leijen. Concurrent programming with revisions and isolation types. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. S. Burckhardt, P. Kothari, M. Musuvathi, and S. Nagarakatte. A randomized scheduler with probabilistic guarantees of finding bugs. In Proceedings of the Fifteenth Edition of ASPLOS on Architectural Support for Programming Languages and Operating Systems, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. J. Burnim, T. Elmas, G. Necula, and K. Sen. Concurrit: Testing concurrent programs with programmable state-space exploration. In Proceedings of the 4th USENIX Conference on Hot Topics in Parallelism, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. R. Chugh, J. A. Meister, R. Jhala, and S. Lerner. Staged information flow for JavaScript. In the Conference on Programming Language Design and Implementation, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. R. Chugh, D. Herman, and R. Jhala. Dependent types for JavaScript. In the Conference on Object Oriented Programming Systems Languages and Applications, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. R. Chugh, P. M. Rondon, and R. Jhala. Nested refinements: A logic for duck typing. In the Symposium on Principles of Programming Languages, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. D. Clarke and S. Drossopoulou. Ownership, encapsulation and the disjointness of type and effect. In Proceedings of the 17th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. F. Craciun, W.-N. Chin, G. He, and S. Qin. An intervalbased inference of variant parametric types. In the European Symposium on Programming Languages and Systems, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. K. Crary, S. Weirich, and G. Morrisett. Intensional polymorphism in type-erasure semantics. In Proceedings of the International Conference on Functional Programming, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. J. Dean and S. Ghemawat. Mapreduce: Simplified data processing on large clusters. In the Conference on Symposium on Opearting Systems Design & Implementation, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. R. Dyer. Task fusion: Improving utilization of multi-user clusters. In Proceedings of the 2013 Companion Publication for Conference on Systems, Programming, and Applications: Software for Humanity, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. J. Erickson, M. Musuvathi, S. Burckhardt, and K. Olynyk. Effective data-race detection for the kernel. In Proceedings of the 9th USENIX Conference on Operating Systems Design and Implementation, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. M. D. Ernst, C. S. Kaplan, and C. Chambers. Predicate dispatching: A unified theory of dispatch. In the European Conference on Object-Oriented Programming, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. J. S. Foster, T. Terauchi, and A. Aiken. Flow-sensitive type qualifiers. In Proceedings of the Conference on Programming Language Design and Implementation, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. T. Freeman and F. Pfenning. Refinement types for ML. In Proceedings of the ACM SIGPLAN 1991 Conference on Programming Language Design and Implementation, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. A. Gotsman, B. Cook, M. Parkinson, and V. Vafeiadis. Proving that non-blocking algorithms don’t block. In Proceedings of the 36th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. A. Greenhouse and J. Boyland. An object-oriented effects system. In Proceedings of the 13th European Conference on Object-Oriented Programming. 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. A. Guha, C. Saftoiu, and S. Krishnamurthi. Typing local control and state using flow analysis. In the European Conference on Programming Languages and Systems, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. R. Harper and G. Morrisett. Compiling polymorphism using intensional type analysis. In Proceedings of the Symposium on Principles of Programming Languages, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. S. T. Heumann, V. S. Adve, and S. Wang. The tasks with effects model for safe concurrency. In Proceedings of the 18th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. A. Kulkarni, Y. D. Liu, and S. F. Smith. Task types for pervasive atomicity. In the conference on Object-oriented programming, systems, languages, and applications, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. M. Kulkarni, P. Carribault, K. Pingali, G. Ramanarayanan, B. Walter, K. Bala, and L. P. Chew. Scheduling strategies for optimistic parallel execution of irregular programs. In Proceedings of the Twentieth Annual Symposium on Parallelism in Algorithms and Architectures, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. A. Le, O. Lhoták, and L. Hendren. Using inter-procedural side-effect information in JIT optimizations. In the International Conference on Compiler Construction, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. D. Lea. A Java fork/join framework. In Proceedings of the ACM 2000 Conference on Java Grande, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. X. Leroy and F. Pessaux. Type-based analysis of uncaught exceptions. ACM Trans. Program. Lang. Syst., 22, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Y. Long and H. Rajan. First-Class Effect Reflection for Effect-Guided Programming. Technical Report 16-1, Iowa State U., Computer Sc., 2016.Google ScholarGoogle Scholar
  34. Y. Long and H. Rajan. A type-and-effect system for asynchronous, typed events. In Proceedings of the 15th International Conference on Modularity, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Y. Long, Y. D. Liu, and H. Rajan. Intensional effect polymorphism. In Proceedings of the 29th European Conference on Object-oriented Programming, 2015.Google ScholarGoogle Scholar
  36. S. Lu, S. Park, E. Seo, and Y. Zhou. Learning from mistakes: A comprehensive study on real world concurrency bug characteristics. In Proceedings of the 13th International Conference on Architectural Support for Programming Languages and Operating Systems, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. J. M. Lucassen and D. K. Gifford. Polymorphic effect systems. In Proceedings of the 15th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. D. Marino and T. Millstein. A generic type-and-effect system. In Proceedings of the 4th international workshop on Types in language design and implementation, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. T. Millstein. Practical predicate dispatch. In Proceedings of the ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. S. Narayanasamy, Z. Wang, J. Tigani, A. Edwards, and B. Calder. Automatically classifying benign and harmful data races using replay analysis. In the Conference on Programming Language Design and Implementation, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. I. Neamtiu, M. Hicks, G. Stoyle, and M. Oriol. Practical dynamic software updating for C. In PLDI ’06. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. I. Neamtiu, M. Hicks, J. S. Foster, and P. Pratikakis. Contextual effects for version-consistent dynamic software updating and safe concurrent programming. In Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. F. Nielson and H. R. Nielson. Type and effect systems. In Correct System Design, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. N. Nystrom, V. Saraswat, J. Palsberg, and C. Grothoff. Constrained types for object-oriented languages. In Proceedings of the 23rd ACM SIGPLAN Conference on Object-oriented Programming Systems Languages and Applications, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. J. Philbin, J. Edler, O. J. Anshus, C. C. Douglas, and K. Li. Thread scheduling for cache locality. In Proceedings of the Seventh International Conference on Architectural Support for Programming Languages and Operating Systems, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. K. Pingali, D. Nguyen, M. Kulkarni, M. Burtscher, M. A. Hassaan, R. Kaleem, T.-H. Lee, A. Lenharth, R. Manevich, M. Méndez-Lojo, D. Prountzos, and X. Sui. The tao of parallelism in algorithms. In the Conference on Programming Language Design and Implementation, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. H. Rajan and G. T. Leavens. Ptolemy: A language with quantified, typed events. In ECOOP ’08. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. K. Ravichandran and S. Pande. Multiverse: Efficiently supporting distributed high-level speculation. In Proceedings of the International Conference on Object Oriented Programming Systems Languages and Applications, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. F. B. Schneider. Enforceable security policies. ACM Trans. Inf. Syst. Secur., 3, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. J. Siek and W. Taha. Gradual typing for objects. In Proceedings of the 21st European Conference on Object-Oriented Programming, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. D. Smith and R. Cartwright. Java type inference is broken: Can we fix it? In Proceedings of the 23rd ACM SIGPLAN Conference on Object-oriented Programming Systems Languages and Applications, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. J.-P. Talpin and P. Jouvelot. The type and effect discipline. Inf. Comput., 111, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. M. Toro and É. Tanter. Customizable gradual polymorphic effects for Scala. In Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. S. Treichler, M. Bauer, and A. Aiken. Language support for dynamic, hierarchical data partitioning. In Proceedings of the ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages and Applications, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. X. Yang, S. M. Blackburn, D. Frampton, J. B. Sartor, and K. S. McKinley. Why nothing matters: The impact of zeroing. In the Conference on Object Oriented Programming Systems Languages and Applications, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. J. Yi and C. Flanagan. Effects for cooperable and serializable threads. In Proceedings of the 5th ACM SIGPLAN Workshop on Types in Language Design and Implementation, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. First-class effect reflection for effect-guided programming

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 51, Issue 10
        OOPSLA '16
        October 2016
        915 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/3022671
        Issue’s Table of Contents
        • cover image ACM Conferences
          OOPSLA 2016: Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications
          October 2016
          915 pages
          ISBN:9781450344449
          DOI:10.1145/2983990

        Copyright © 2016 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 19 October 2016

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!