Hasty Briefsbeta

Spectrum – catching clojure.spec conform errors at compile time

14 days ago
  • #Static Analysis
  • #Clojure
  • #Type Checking
  • Spectrum is a library for static analysis of Clojure code, catching clojure.spec conform errors at compile time.
  • It is similar to core.typed but relies on clojure.spec annotations, functioning as an optional static type system.
  • Currently in Developer Preview, not ready for production use, with development focused on making Spectrum self-check.
  • Goals include being usable, pragmatic, readable, fast, configurable strictness levels, incremental checking, and aiming for perfection and correctness.
  • Spectrum aims to catch 80% of bugs with low false positives, prioritizing usability over catching 100% of type errors initially.
  • Usage involves clojure.spec as normal, with additional REPL commands for inferring types of vars and forms.
  • Limitations of clojure.spec include difficulty in checking return values, non-pure functions, and challenges with generative testing.
  • Spectrum addresses some clojure.spec limitations but is not a replacement, offering extra compile-time checks.
  • The project is under active development, with a focus on practicality and catching bugs efficiently.