Testing with types

Type checking is something that is often taken for granted in statically typed languages. With type checking, type errors can be found at compile time, rather than during runtime. In some dynamic languages such as Clojure, type signatures can be declared wherever and whenever they are required, and this technique is termed as optional typing. Type checking can be done using the core.typed library (https://github.com/clojure/core.typed). Using core.typed, the type signature of a var can be checked using type annotations. Type annotations can be declared for any var, which includes values created using a def form, a binding form, or any other construct that creates a var. In this section, we will explore the details of this library. ...

Get Clojure: High Performance JVM Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.