Dynamic languages have many compelling benefits, but the lack of static types means subtle errors can remain latent in code for a long time. While many researchers have developed various systems to bring some of the benefits of static types to dynamic languages, prior approaches have trouble dealing with metaprogramming, which generates code as the program executes. For example, Ruby on Rails is a powerful framework that relies heavily on metaprogramming.
In this paper, we propose Hummingbird, a new system that can type check Ruby code even in the presence of metaprogramming. In Hummingbird, method type signatures are gathered dynamically at run-time, as those methods are created. When a method is called, Hummingbird statically type checks the method body against current type signatures. Thus, Hummingbird provides thorough static checks on a per-method basis, while also allowing arbitrarily complex metaprogramming. For performance, Hummingbird memoizes the static type checking pass, invalidating cached checks only if necessary. We formalize Hummingbird using a core, Ruby-like language and prove it sound. We also implemented Hummingbird and applied it to six apps, including three that use Rails. We found that all apps typecheck successfully using Hummingbird. By applying Hummingbird to earlier versions of one app, we also found several type errors that were introduced and then fixed. Finally, we found that Hummingbird’s performance overhead is reasonable.
Thu 16 Jun Times are displayed in time zone: Tijuana, Baja California change
|15:30 - 16:00|
|Just-in-Time Static Type Checking for Dynamic Languages|
Brianna M. RenUniversity of Maryland, College Park, Jeffrey S. FosterUniversity of Maryland, College ParkMedia Attached
|16:00 - 16:30|
|Types from data: Making structured data first-class citizens in F#|
Tomas PetricekUniversity of Cambridge, UK, Don SymeMicrosoft, Gustavo GuerraMicrosoft Corporation, LondonPre-print Media Attached
|16:30 - 17:00|
|Automatically Learning Shape Specifications|
He ZhuPurdue University, Gustavo PetriLIAFA, Université Paris Diderot, Suresh JagannathanPurdue UniversityMedia Attached