Shallow Types for Insightful Programs: Grace is Optional, Performance is Not
Languages with explicit dynamic type checking are increasing in popularity in both practical development and programming education. Unfortunately, current implementations of these languages perform worse than either purely statically or purely dynamically typed languages. We show how virtual machines can use common optimizations to remove redundancy in dynamic type checking, by adding shallow structural type checks to Moth, a Truffle-based interpreter for Grace. Moth runs programs with dynamic type checks roughly as fast as programs without checks, so developers do not need to disable checks in production code, and educators can teach types without also teaching that types slow programs down.
READ FULL TEXT