Re:Clojure 1.11 planning
by Scarbutt on Tuesday October 08, 2019 @10:44AM
(#21192855)
I remember spec being pitch for something you only use at dev time and turn off in production because it makes your runtime very very slow, what has change? Seems users are using it for everything now.
[ Parent
| on HN ]
Re:Clojure 1.11 planning
by seancorfield on Tuesday October 08, 2019 @04:39PM
(#21196978)
Spec has numerous uses. We use it heavily in production for data validation/conformance: https://corfield.org/blog/2019/09/13/using-spec/
I bet you are thinking of https://clojure.org/guides/spec#_instrumentation_and_testing - it was always just one use of spec among many.
We don't have instrumentation in production, ie. we spec much more at dev time. But for things you'd validate anyway spec is a good match and probably about as performant as hand-written validation.
The only strange use of spec I mentioned is validating db queries. For us updates and deletes are rare enough that perf doesn't matter.