Strong, Fast Checking for Structural Types

TypeScript extends JavaScript with optional type annotations that are unsound by design and discarded by the TypeScript compiler as it emits code. This design point preserves programming idioms developers are familiar with, and allows them to leave their legacy code unchanged, while offering a measure of static error checking in parts of the program that have type annotations.

Languages such as SafeTypeScript and our own StrongScript extend this by adding sound type checking, but with a tradeoff: SafeTypeScript is substantially slower than TypeScript due to runtime checks, and StrongScript is more restrictive, as only nominal types are checkable.

Meanwhile, Just-in-Time (JIT) compilers for JavaScript achieve performance by inferring types, and thus treating objects like instances of classes in Java or any other statically-typed programming language.

This raises a question: How does one technology use types to be faster, while a closely related technology uses types to be slower? The answer is that there is an impedence mismatch between the types understood and inferred by the JIT, and those created by the language. This project aims to rectify that.

Our JIT is based on Higgs, a virtual machine for JavaScript which uses basic block versioning.


Resources


People


Last update: