Welcome to the.gregor.institute, academic home of Gregor Richards.
I teach at the University of Waterloo School of Computer Science. My
office is DC2508. When applicable, my office hours are listed on the
course web page of the course I am currently teaching. Students are
advised to look there.
Feel free to email me at .
In the winter of 2019 I am teaching CS842: Virtual Machines for Dynamic Languages.
My research is in programming language and virtual machine design, in
particular dynamic and gradually-typed languages. I am interested in
provides static assurance for a reasonable subset of the
makes the boundaries which cause performance problems in
gradually-typed systems clear,
integrates both conventional static types and C-like memory types,
allows for truly-harmless type evolution (adding types with no
effect on dynamic code).
My current projects are
Using type system techniques to improve foreign function
interfaces: FFI's typically wrap values from C, with the effect that
accessing deeply nested data structures can have a significant
performance impact, as well as defying all semantic reasoning. We are
developing a type system and implementation which reflects C's types
into the host language, thus achieving predictable, performant
VM support for gradual typing: Conventional gradually typed
languages use wrappers to enforce contracts. Our modified VM,
HiggsCheck, avoids these wrappers by modifying object shapes. This
allows HiggsCheck to implement gradual typing much faster—in some
cases, hundreds of times faster—than existing solutions.
Locus Types: A new way of writing types that minimizes syntactic
overheads. Locus types reify the concept of "object created here" as a
type, where the structure of that type is determined by the
statically-testable facts about the changes to the object made in a
particular function. Put simply, to declare a type, the programmer
simply annotates which function makes objects of that type. Under the
covers this uses TypeScript plus flow-based type inference.
Low-Level Gradual Typing: C interfaces in dynamic languages usually
involve a fairly expensive "thunk" layer which translates all dynamic
accesses into simple memory accesses, and involves allocating dynamic
objects to wrap each C object. Without a type system this is
unavoidable, but with a (gradual) type system it should be unnecessary.
We're implementing a variety of Lua that will eliminate this extra
baggage for accessing C objects.
Other possible projects: These are things I have on the docket but
are not primary projects. A user study of the maintenance effects of
gradual typing. Software engineering tools to suggest where gradual
typing could be most beneficial, and equivalent dynamic analysis tools
to eliminate gradual checks if they hinder performance.