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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.