hvrosen
12/06/2021, 12:11 PMhvrosen
12/06/2021, 12:19 PMJimmy Miller
curious_reader
12/16/2021, 10:29 AMJimmy Miller
hvrosen
12/22/2021, 6:41 PMspec
as a failure piqued my interest. I’m not inside Clojure, just read about spec
and found a lot of beautiful ideas went into it, so how has it failed in your perspective? (I found no easily googleable online content on the topic)Jimmy Miller
(defn get-x [{:x x}] x)
=> Error ;; Shortened from actual output
Syntax error macroexpanding clojure.core/defn at (REPL:1:1).
{:x x} - failed: vector? at: [:fn-tail :arity-n :bodies :params] spec: :clojure.core.specs.alpha/param-list
({:x x}) - failed: Extra input at: [:fn-tail :arity-1 :params] spec: :clojure.core.specs.alpha/param-list
[{:path [:fn-tail :arity-1 :params],
:reason "Extra input",
:pred (clojure.spec.alpha/cat
:params
(clojure.spec.alpha/* :clojure.core.specs.alpha/binding-form)
:var-params
(clojure.spec.alpha/?
(clojure.spec.alpha/cat
:ampersand
#{(quote &)}
:var-form
:clojure.core.specs.alpha/binding-form))),
:val ({:x x}),
:via [:clojure.core.specs.alpha/defn-args
:clojure.core.specs.alpha/params+body
:clojure.core.specs.alpha/param-list
:clojure.core.specs.alpha/param-list],
:in [1 0]}
{:path [:fn-tail :arity-n :bodies :params],
:pred clojure.core/vector?,
:val {:x x},
:via [:clojure.core.specs.alpha/defn-args
:clojure.core.specs.alpha/params+body
:clojure.core.specs.alpha/params+body
:clojure.core.specs.alpha/params+body
:clojure.core.specs.alpha/param-list
:clojure.core.specs.alpha/param-list],
:in [1 0]}]
There are a number of other issues. But overall I think spec really missed the mark. I don’t know of anyone who really is a big advocate of it. I really was excited when it came out. Really wanted to love it. But now avoid it.Jimmy Miller
curious_reader
01/03/2022, 11:52 AM