ABSTRACT
We present the Ruby Type Checker (rtc), a tool that adds type checking to Ruby, an object-oriented, dynamic scripting language. Rtc is implemented as a Ruby library in which all type checking occurs at run time; thus it checks types later than a purely static system, but earlier than a traditional dynamic type system. Rtc supports type annotations on classes, methods, and objects and rtc provides a rich type language that includes union and intersection types, higherorder (block) types, and parametric polymorphism among other features. Rtc is designed so programmers can control exactly where type checking occurs: type-annotated objects serve as the "roots" of the type checking process, and unannotated objects are not type checked. We have applied rtc to several programs and found it to be easy to use and effective at checking types.
- Jong-hoon (David) An, Avik Chaudhuri, Jeffrey S. Foster, and Michael Hicks. Dynamic Inference of Static Types for Ruby. In POPL, 2011. Google ScholarDigital Library
- Jong-hoon (David) An, Avik Chaudhuri, Jefrey S. Foster, and Michael Hicks. Position Paper: Dynamically Inferred Types for Dynamic Languages. In STOP, 2011.Google Scholar
- Davide Ancona, Massimo Ancona, Antonio Cuni, and Nicholas Matsakis. RPython: Reconciling Dynamically and Statically Typed OO Languages. In DLS, 2007. Google ScholarDigital Library
- Christopher Anderson, Paola Giannini, and Sophia Drossopoulou. Towards Type Inference for JavaScript. In ECOOP, 2005. Google ScholarDigital Library
- John Aycock. Aggressive Type Inference. In International Python Conference, 2000.Google Scholar
- Bard Bloom, John Field, Nathaniel Nystrom, Johan Östlund, Gregor Richards, Rok Strniša, Jan Vitek, and Tobias Wrigstad. Thorn: Robust, Concurrent, Extensible Scripting on the JVM. In OOPSLA, 2009. Google ScholarDigital Library
- Robert Bruce Findler and Matthias Felleisen. Contracts for Higher-Order Functions. In ICFP, 2002.Google ScholarDigital Library
- Michael Furr, Jong-hoon (David) An, and Jeffrey S. Foster. Profile-Guided Static Typing for Dynamic Scripting Languages. In OOPSLA, 2009. Google ScholarDigital Library
- Michael Furr, Jong-hoon (David) An, Jeffrey S. Foster, and Michael Hicks. Static Type Inference for Ruby. In OOPS Track at SAC, 2009. Google ScholarDigital Library
- Bertrand Meyer. Applying Design by Contract. IEEE Computer, 25(10):40--51, October 1992. Google ScholarDigital Library
- Michael Salib. Starkiller: A Static Type Inferencer and Compiler for Python. Master's thesis, MIT, 2004.Google Scholar
- Jeremy G. Siek and Walid Taha. Gradual Typing for Functional Languages. In Scheme and Functional Programming Workshop, 2006.Google Scholar
- T. Stephen Strickland and Matthias Felleisen. Contracts for First-Class Classes. In DLS, 2010. Google ScholarDigital Library
- Peter Thiemann. Towards a Type System for Analyzing JavaScript Programs. In ESOP, 2005. Google ScholarDigital Library
- Sam Tobin-Hochstadt and Matthias Felleisen. The Design and Implementation of Typed Scheme. In POPL, 2008. Google ScholarDigital Library
Index Terms
- The ruby type checker
Recommendations
Type-level computations for Ruby libraries
PLDI 2019: Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and ImplementationMany researchers have explored ways to bring static typing to dynamic languages. However, to date, such systems are not precise enough when types depend on values, which often arises when using certain Ruby libraries. For example, the type safety of a ...
Sound, heuristic type annotation inference for Ruby
DLS 2020: Proceedings of the 16th ACM SIGPLAN International Symposium on Dynamic LanguagesMany researchers have explored retrofitting static type systems to dynamic languages. This raises the question of how to add type annotations to code that was previously untyped. One obvious solution is type inference. However, in complex type systems, ...
Static type inference for Ruby
SAC '09: Proceedings of the 2009 ACM symposium on Applied ComputingMany general-purpose, object-oriented scripting languages are dynamically typed, which provides flexibility but leaves the programmer without the benefits of static typing, including early error detection and the documentation provided by type ...
Comments