Philly ETE 2017 #41 – Clojure spec: Expressing Data Constraints without Types – Alex Miller

Tags: , , ,

Clojure programs are built from a small number of generic immutable data structures combined with a large number of pure functions that manipulate these generic data types. The Clojure development experience is characterized by a rapid, dynamic, and interactive REPL-driven experience.

Clojure’s new spec library enhances Clojure by providing a system for stating concrete declarative specifications for your data and functions. Because the specifications are based in the same language as the program, they are expressive and concrete.

Specs are fully integrated with Clojure and can be used within your programs for validation, documentation, destructuring, instrumentation, data generation, and automatic generative testing. Unlike types, specs can be added iteratively or selectively to some or all of your program – it’s up to you when and how much to use.