Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/3314221.3314600acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

Characterising renaming within OCaml’s module system: theory and implementation

Published: 08 June 2019 Publication History

Abstract

We present an abstract, set-theoretic denotational semantics for a significant subset of OCaml and its module system, allowing to reason about the correctness of renaming value bindings. Our semantics captures information about the binding structure of programs, as well as about which declarations are related by the use of different language constructs (e.g. functors, module types and module constraints). Correct renamings are precisely those that preserve this structure. We show that our abstract semantics is sound with respect to a (domain-theoretic) denotational model of the operational behaviour of programs, and that it allows us to prove various high-level, intuitive properties of renamings. This formal framework has been implemented in a prototype refactoring tool for OCaml that performs renaming.

Supplementary Material

Auxiliary Archive (pldi19main-p160-p-aux.zip)
Appendix and Coq proofs.
WEBM File (p950-rowe.webm)
MP4 File (3314221.3314600.mp4)
Video Presentation

References

[1]
2012. OCaml Bug Report 5514: “with module” semantics seem broken. https://github.com/ocaml/ocaml/issues/5514 Last accessed 22 nd March 2018. Communicated to us by Leo White.
[2]
2016. The Core OCaml System: Compilers, Runtime System, Base Libraries (version 4.04.0). https://github.com/ocaml/ocaml/tree/4.04.0
[3]
2018. Dune: A Composable Build System. https://github.com/ocaml/ dune
[4]
2019. A Prototype Refactoring Tool for OCaml. https://gitlab.com/ trustworthy-refactoring/refactorer/
[5]
2019. A Prototype Refactoring Tool for OCaml (Docker Image). https: //hub.docker.com/r/reubenrowe/ocaml-rotor/
[6]
Hendrik van Antwerpen, Casper Bach Poulsen, Arjen Rouvoet, and Eelco Visser. 2018. Scopes As Types. PACMPL 2, OOPSLA (2018), 114:1–114:30.
[7]
Joe Armstrong, Robert Virding, Claes Wikström, and Mike Williams. 1996. Concurrent Programming in ERLANG (2 nd ed.). Prentice Hall International (UK) Ltd., Hertfordshire, UK.
[8]
Pavel Avgustinov, Oege de Moor, Michael Peyton Jones, and Max Schäfer. 2016. QL: Object-oriented Queries on Relational Data. In 30th European Conference on Object-Oriented Programming, ECOOP 2016, July 18-22, 2016, Rome, Italy. 2:1–2:25.
[9]
Martin Bravenboer, Karl Trygve Kalleberg, Rob Vermaas, and Eelco Visser. 2008. Stratego/XT 0.17. A Language and Toolset for Program Transformation. Sci. Comput. Program. 72 (2008), 52–70. Issue 1–2.
[10]
The Coq Development Team. 2018. The Coq Proof Assistant, version 8.8.0.
[11]
Martin Fowler, Kent Beck, John Brant, William Opdyke, and Don Roberts. 1999. Refactoring: Improving the Design of Existing Code. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.
[12]
Alain Frisch. 2014. PPX and Extension Points. https://lexifi.com/blog/ ppx-and-extension-points (blog post).
[13]
William G. Griswold and William F. Opdyke. 2015. The Birth of Refactoring: A Retrospective on the Nature of High-Impact Software Engineering Research. IEEE Software 32, 6 (2015), 30–38.
[14]
Elnar Hajiyev, Mathieu Verbaere, Oege de Moor, and Kris De Volder. 2005. CodeQuest: Querying Source Code with Datalog. In Companion to the 20th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2005, October 16-20, 2005, San Diego, CA, USA. ACM, New York, NY, USA, 102–103.
[15]
Jane Street. 2018. Standard Library Overlay. https://github.com/ janestreet/core
[16]
Ramana Kumar, Magnus O. Myreen, Michael Norrish, and Scott Owens. 2014. CakeML: A Verified Implementation of ML. In The 41st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’14, San Diego, CA, USA, January 20-21, 2014. ACM, New York, NY, USA, 179–192.
[17]
Ralf Lämmel and Simon Peyton Jones. 2003. Scrap Your Boilerplate: A Practical Design Pattern for Generic Programming. In Proceedings of TLDI’03: 2003 ACM SIGPLAN International Workshop on Types in Languages Design and Implementation, New Orleans, Louisiana, USA, January 18, 2003. ACM, New York, NY, USA, 26–37.
[18]
Ralf Lämmel and Joost Visser. 2003. A Strafunski Application Letter. In Practical Aspects of Declarative Languages, 5th International Symposium, PADL 2003, New Orleans, LA, USA, January 13-14, 2003, Proceedings. Springer-Verlag, Heidelberg Berlin, Germany, 357–375.
[19]
Xavier Leroy. 1994. Manifest Types, Modules, and Separate Compilation. In Proceedings of POPL’94: 21 st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Portland, Oregon, USA, January 17–21, 1994. ACM, New York, NY, USA, 109–122.
[20]
Xavier Leroy. 1995. Applicative Functors and Fully Transparent HigherOrder Modules. In Conference Record of POPL’95: 22 nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, San Francisco, California, USA, January 23–25, 1995. ACM, New York, NY, USA, 142–153.
[21]
Xavier Leroy, Damien Doligez, Alain Frisch, Jacques Garrigue, Didier Rémy, and Jérôme Vouillon. 2018. The OCaml System Release 4.07 Documentation and User’s Manual. http://caml.inria.fr/pub/docs/ manual-ocaml/
[22]
Huiqing Li and Simon J. Thompson. 2012. A Domain-Specific Language for Scripting Refactorings in Erlang. In Fundamental Approaches to Software Engineering - 15th International Conference, FASE 2012, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2012, Tallinn, Estonia, March 24 – April 1, 2012. Proceedings. 501–515.
[23]
Huiqing Li, Simon J. Thompson, George Orösz, and Melinda Tóth. 2008. Refactoring with Wrangler, Updated: Data and Process Refactorings, and Integration with Eclipse. In Proceedings of the 7th ACM SIGPLAN workshop on ERLANG, Victoria, BC, Canada, September 27, 2008. 61–72.
[24]
Huiqing Li, Simon J. Thompson, and Claus Reinke. 2005. The Haskell Refactorer, HaRe, and its API. Electr. Notes Theor. Comput. Sci. 141, 4 (2005), 29–34.
[25]
Yuan Lin. 2008. Completeness of Fact Extractors and a New Approach to Extraction with Emphasis on the Refers-to Relation. Ph.D. Dissertation. http://hdl.handle.net/10012/3865
[26]
Yuan Lin and Richard C. Holt. 2004. Formalizing Fact Extraction. Electr. Notes Theor. Comput. Sci. 94 (2004), 93–102.
[27]
Yuan Lin, Richard C. Holt, and Andrew J. Malton. 2003. Completeness of a Fact Extractor. In 10th Working Conference on Reverse Engineering, WCRE 2003, Victoria, Canada, November 13-16, 2003. 196–205.
[28]
Massimiliano Menarini, Yan Yan, and William G. Griswold. 2017. Semantics-assisted Code Review: An Efficient Toolchain and a User Study. In Proceedings of the 32nd IEEE/ACM International Conference on Automated Software Engineering, ASE 2017, Urbana, IL, USA, October 30 – November 03, 2017. IEEE Computer Society, 554–565.
[29]
Tom Mens and Tom Tourwé. 2004. A Survey of Software Refactoring. IEEE Trans. Softw. Eng. 30 (2004), 126–139. Issue 2.
[30]
Yaron Minsky, Anil Madhavapeddy, and Jason Hickey. 2013. Real World OCaml: Functional Programming for the Masses. O’Reilly Media, Sebastopol, CA, USA.
[31]
Pierre Neron, Andrew P. Tolmach, Eelco Visser, and Guido Wachsmuth. 2015. A Theory of Name Resolution. In Programming Languages and Systems - 24th European Symposium on Programming, ESOP 2015, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2015, London, UK, April 11-18, 2015. Proceedings. 205– 231.
[32]
William F. Opdyke. 1992. Refactoring Object-Oriented Frameworks. Ph.D. Dissertation. University of Illinois at Urbana-Champaign.
[33]
Simon Peyton Jones (Ed.). 2003. Haskell 98 Language and Libraries: Revised Report. Cambridge University Press, Cambridge, UK. https: //haskell.org/onlinereport
[34]
François Pottier. 2017. Visitors Unchained. PACMPL 1, ICFP (2017), 28:1–28:28.
[35]
Casper Bach Poulsen, Pierre Néron, Andrew P. Tolmach, and Eelco Visser. 2016. Scopes Describe Frames: A Uniform Model for Memory Layout in Dynamic Semantics. In 30th European Conference on ObjectOriented Programming, ECOOP 2016, July 18-22, 2016, Rome, Italy. 20:1– 20:26.
[36]
Andreas Rossberg, Claudio V. Russo, and Derek Dreyer. 2014. F-ing Modules. J. Funct. Program. 24, 5 (2014), 529–607.
[37]
Max Schäfer, Torbjörn Ekman, and Oege de Moor. 2008. Sound and Extensible Renaming for Java. In Proceedings of the 23rd ACM SIGPLAN Conference on Object-oriented Programming Systems Languages and Applications (OOPSLA ’08). ACM, New York, NY, USA, 277–294.
[38]
Jeremy G. Siek and Walid Taha. 2006. Gradual Typing for Functional Languages. In Scheme and Functional Programming 2006 - Proceedings of the 2006 Workshop on Scheme and Functional Programming, Portland, Oregon, Sunday September 17, 2006, Robert Bruce Findler (Ed.). University of Chicago, 1100 East 58th Street, Chicago, IL 60637, 81–92. https://newtraell.cs.uchicago.edu/research/publications/ techreports/TR-2006-06 Technical Report TR-2006-06.
[39]
Jeremy G. Siek and Walid Taha. 2007. Gradual Typing for Objects. In ECOOP 2007 - Object-Oriented Programming, 21st European Conference, Berlin, Germany, July 30 - August 3, 2007, Proceedings. 2–27.
[40]
Konrad Slind and Michael Norrish. 2008. A Brief Overview of HOL4. In Theorem Proving in Higher Order Logics, 21st International Conference, TPHOLs 2008, Montreal, Canada, August 18-21, 2008. Proceedings. 28–32.
[41]
Simon Thompson and Huiqing Li. 2013. Refactoring Tools for Functional Languages. Journal of Functional Programming 23, 3 (2013), 293–350.
[42]
Mathieu Verbaere, Ran Ettinger, and Oege de Moor. 2006. JunGL: A Scripting Language for Refactoring. In 28th International Conference on Software Engineering (ICSE 2006), Shanghai, China, May 20-28, 2006. ACM, New York, NY, USA, 172–181.
[43]
Iain Whiteside, David Aspinall, Lucas Dixon, and Gudmund Grov. 2011. Towards Formal Proof Script Refactoring. In Intelligent Computer Mathematics, James H. Davenport, William M. Farmer, Josef Urban, and Florian Rabe (Eds.). Springer, Berlin/Heidelberg, Germany, 260–275.

Cited By

View all
  • (2024)Towards Specification-Guarded RefactoringLogic-Based Program Synthesis and Transformation10.1007/978-3-031-71294-4_9(149-165)Online publication date: 9-Sep-2024
  • (2023)Adventure of a Lifetime: Extract Method Refactoring for RustProceedings of the ACM on Programming Languages10.1145/36228217:OOPSLA2(658-685)Online publication date: 16-Oct-2023
  • (2021)Towards a Generic Framework for Trustworthy Program RefactoringActa Cybernetica10.14232/actacyb.28434925:4(753-779)Online publication date: 18-Mar-2021
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
PLDI 2019: Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation
June 2019
1162 pages
ISBN:9781450367127
DOI:10.1145/3314221
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 the author(s) 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].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 08 June 2019

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. Adequacy
  2. OCaml
  3. dependencies
  4. module types
  5. modules
  6. refactoring
  7. renaming
  8. semantics

Qualifiers

  • Research-article

Funding Sources

Conference

PLDI '19
Sponsor:

Acceptance Rates

Overall Acceptance Rate 406 of 2,067 submissions, 20%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)14
  • Downloads (Last 6 weeks)2
Reflects downloads up to 15 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Towards Specification-Guarded RefactoringLogic-Based Program Synthesis and Transformation10.1007/978-3-031-71294-4_9(149-165)Online publication date: 9-Sep-2024
  • (2023)Adventure of a Lifetime: Extract Method Refactoring for RustProceedings of the ACM on Programming Languages10.1145/36228217:OOPSLA2(658-685)Online publication date: 16-Oct-2023
  • (2021)Towards a Generic Framework for Trustworthy Program RefactoringActa Cybernetica10.14232/actacyb.28434925:4(753-779)Online publication date: 18-Mar-2021
  • (2019)RotorProceedings of the 3rd International Workshop on Refactoring10.1109/IWoR.2019.00013(27-30)Online publication date: 28-May-2019

View Options

Get Access

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