Back to search

Digital Repository at the University of Maryland

Dynamic Inference of Static Types for Ruby

Abstract

dc:description.abstract

There have been several efforts to bring static type inference to object-oriented dynamic languages such as Ruby, Python, and Perl. In our experience, however, such type inference systems are extremely difficult to develop, because dynamic languages are typically complex, poorly specified, and include features, such as eval and reflection, that are hard to analyze. In this thesis, we introduce constraint-based dynamic type inference, a technique that infers static types based on dynamic program executions. In our approach, we wrap each run-time value to associate it with a type variable, and the wrapper generates constraints on this type variable when the wrapped value is used. This technique avoids many of the often overly conservative approximations of static tools, as constraints are generated based on how values are used during actual program runs. Using wrappers is also easy to implement, since we need only write a constraint resolution algorithm and a transformation to introduce the wrappers. We have developed Rubydust, an implementation of our algorithm for Ruby. Rubydust takes advantage of Ruby's dynamic features to implement wrappers as a language library. We applied Rubydust to a number of small programs. We found it to be lightweight and useful: Rubydust discovered 1 real type error, and all other inferred types were correct, and readable.

Degree

thesis:*
Department dc:contributor.department
Computer Science
Grantor dc:publisher
Digital Repository at the University of Maryland
Year dc:date.issued
2010

Author and committee

dc:creator, dc:contributor.*
Author dc:creator
  • An, Jong-hoon
Advisors dc:contributor.advisor
  • Foster, Jeffrey S
  • Hicks, Michael W

Identifiers

dc:identifier.*
Handle dc:identifier.uri
http://hdl.handle.net/1903/10946

Chain of custody

source
Harvested from
University of Maryland
Base URL
api.drum.lib.umd.edu/server/oai/request
Last updated
2026-11-19
Source record
OAI-PMH GetRecord
related terms
citation

An, Jong-hoon. Dynamic Inference of Static Types for Ruby. Digital Repository at the University of Maryland, 2010. http://hdl.handle.net/1903/10946