Profile-Guided Static Typing for Dynamic Scripting Languages

Source: University of Maryland

Favorite

Free registration required

Many popular scripting languages such as Ruby, Python, and Perl include highly dynamic language constructs, such as an eval method that evaluates a string as program text. While these constructs allow terse and expressive code, they have traditionally obstructed static analysis. In this paper the authors present PRuby, an extension to Diamondback Ruby (DRuby), a static type inference system for Ruby. PRuby augments DRuby with a novel dynamic analysis and transformation that allows one to precisely type uses of highly dynamic constructs. PRuby's analysis proceeds in three steps. First, the authors use run-time instrumentation to gather per-application profiles of dynamic feature usage. Next, they replace dynamic features with statically analyzable alternatives based on the profile. Finally, they run DRuby's static type inference on the transformed code to enforce type safety.
Format:PDF Size:389.60
Date:Apr 2009