Don’t let programming language designers have all the fun: you can design your own type system that’s better than the current one. Many developers view type theory as abstruse and confusing. It’s not.
Michael Ernst walks you through the four simple components of a type system: the types, subtyping relationships, how to give a type to each expression in your program, and what operations are illegal. Once you specify these four things, you’ve designed a type system. Starting from nothing, in 40 minutes Michael creates a fully fledged type checker that detects real errors in real programs. For concreteness, he implements the type checker for the Java language, and it handles all Java constructs, such as generics, subtyping, and lambdas. This type system will be better than the built-in Java type system: it will detect errors that the Java compiler permits and that would otherwise go undetected until runtime.
Although Mike uses Java, the ideas translate to other languages. Even if you don’t want to implement your own type system, you’ll come away with a better understanding of type systems and of compile-time verification in general. If you’re a Java developer, you’ll also be ready to use dozens of freely available pluggable type systems to improve code quality, which are used daily at companies such as Amazon, Google, and Uber.
Michael Ernst is a professor in the computer science and engineering department at the University of Washington. He’s also the specification lead for JSR 308, which makes Java’s annotation system more expressive. Michael’s research aims to make software more reliable, more secure, and easier (and more fun) to produce. His primary technical interests are in software engineering and related areas, including programming languages, type theory, security, program analysis, bug prediction, testing, and verification. His research combines strong theoretical foundations with realistic experimentation with an eye to changing the way that software developers work. Previously, he was a tenured professor at MIT and a researcher at Microsoft Research.
©2019, O'Reilly Media, Inc. • (800) 889-8969 or (707) 827-7019 • Monday-Friday 7:30am-5pm PT • All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners. • email@example.com