Toward a Corpus Study of the Dynamic Gradual Type
Dibri Nsofor, Ben Greenman
TL;DR
The paper investigates why developers rely on the dynamic Any type in gradually typed Python programs. It presents a formative pre-corpus study of 221 mypy-using GitHub projects, extracting 28,478 Any occurrences and distilling eight usage patterns to guide tooling and language design. The results point to concrete improvements for mypy, such as supporting dependent dictionaries and a Self-type insertion workflow, and to broader methodological lessons for corpus-based gradual-type design. Together, the work offers a scalable approach to studying gradual typing in large codebases and informs a path toward balancing type-system expressiveness with real-world usability.
Abstract
Gradually-typed languages feature a dynamic type that supports implicit coercions, greatly weakening the type system but making types easier to adopt. Understanding how developers use this dynamic type is a critical question for the design of useful and usable type systems. This paper reports on an in-progress corpus study of the dynamic type in Python, targeting 221 GitHub projects that use the mypy type checker. The study reveals eight patterns-of-use for the dynamic type, which have implications for future refinements of the mypy type system and for tool support to encourage precise type annotations.
