In this talk, I will describe our work developing a tool to automatically perform renaming of functions in OCaml. This ostensibly simple task is not as straightforward as it might at first seem, due to OCaml's rich module system, language infrastructure and preprocessors. Our main observation is that renaming a particular function in one module may require renaming declarations and functions in many other signatures and modules. In this sense, renamings can comprise many constituent atomic steps which all 'depend' on each other for their overall correctness.I will first present a set-theoretic static semantics for a core subset of OCaml, which we have developed to formally describe exactly which parts of a program must be changed in order to correctly rename a function. This allows us to develop a 'theory' of renaming for OCaml. I will then describe ROTOR, a prototype tool that we have developed to carry out renaming on OCaml codebases. We have tested ROTOR on some moderately large codebases, including a subset of Jane Street Capital's publicly available libraries, and the OCaml compiler itself.This is joint work with Simon, Hugo and Scott, which we have submitted to PLDI.
Cornwallis South West,
University of Kent,