Dynamic languages are flexible, allowing small, expressive programs to be written with little effort. As these programs evolve, the lack of static typing makes them increasingly difficult to maintain, extend, and reason about. We explore static type systems for dynamic languages like Ruby. Our type systems are designed to handle common idioms used by Ruby programmers meaning that programs need not be changed in order to gain the benefits of static checks. Our main project is RDL, a lightweight system for adding types, type checking, and contracts to Ruby. RDL supports just-in-time static type checking that allows it to type check Ruby code that uses metaprogramming. This is possible because the programmer may control at what point of execution the type checking is done.
Ideas from this work have inspired an industrial type checker for Ruby, Sorbet. Sorbet is developed by Stripe and is used by dozens of companies in their production systems. Ruby 3, whose release is upcoming, plans similar opt-in static type annotations for Ruby programs.
Past type systems we have developed have explored constraint based dynamic type inference, static analysis by transforming the source to an intermediate language, statically checked refinement types. We are now exploring problems of practical type inference for Ruby programs, including machine learning based methods for type inference, and ways to efficiently synthesize Ruby programs from tests using types to guide the search.
Past publications from members of this project:
- Type Checking and Inference for Dynamic Languages, Dissertation. Brianna Ren.
- Type-Level Computations for Ruby Libraries, PLDI 2019. Milod Kazerounian, Sankha Narayan Guria, Niki Vazou, Jeffrey S. Foster, and David Van Horn.
- Refinement Types for Ruby, VMCAI 2018. Milod Kazerounian, Niki Vazou, Austin Bourgerie, Jeffrey S. Foster, and Emina Torlak.
- Just-in-Time Static Type Checking for Dynamic Languages, PLDI 2016. Brianna M. Ren and Jeffrey S. Foster.
- Contracts for Domain-Specific Languages in Ruby, DLS 2014. T. Stephen Strickland, Brianna Ren, and Jeffrey S. Foster.
- The Ruby Type Checker, OOPS 2013. Brianna M. Ren, John Toman, T. Stephen Strickland, and Jeffrey S. Foster.
- Dynamic Inference of Static Types for Ruby, POPL 2011. Jong-hoon (David) An, Avik Chaudhuri, Jeffrey S. Foster, and Michael Hicks.
- Position Paper: Dynamically Inferred Types for Dynamic Languages, STOP 2011. Jong-hoon (David) An, Avik Chaudhuri, Jeffrey S. Foster, and Michael Hicks.
- Dynamic Inference of Static Types for Ruby, Thesis. Jong-hoon (David) An.
- Static Typing for Ruby on Rails, ASE 2009. Jong-hoon (David) An, Avik Chaudhuri, and Jeffrey S. Foster.
- Combining Static and Dynamic Typing in Ruby, Dissertation. Michael Furr.
- The Ruby Intermediate Langauge, DLS 2009. Michael Furr, Jong-hoon (David) An, Jeffrey S. Foster, and Michael Hicks.
- Profile-Guided Static Typing for Dynamic Scripting Languages, OOPSLA 2009. Michael Furr, Jong-hoon (David) An, and Jeffrey S. Foster.
- Static Type Inference for Ruby, OOPS 2009. Michael Furr, Jong-hoon (David) An, Jeffrey S. Foster, and Michael Hicks.