Fork me on GitHub

Anyone have experience using clojure.spec to spec out macros for use in clojurescript?


I get odd errors relating to clojure.spec not being found when I run clojure 1.9.


Might just be my setup.


Use the cljs.spec namespace in Clojurescript.


I have been trying to use clojure.spec to coerce edn (config) files. EDN prevents autonamespacing keywords ( I get that now, thanks alexmiller ), but allow custom #readers. Clojure (well read-string and load-file) allow autonamespacing but prevent custom readers. So it seems that my only option is to explicitly have the keyword namespace every time in my configuration file, is that correct ? I am asking because I find it a bit cumbersome/repetitive to have to have these in my file.

Alex Miller (Clojure team)16:07:20

Yes, you'll need full namespaces in edn config files

Alex Miller (Clojure team)16:07:19

You could also write specs on unqualified keys with req-un and opt-un


Ah I see - not super familiar with spec yet. Will look into those keys, thanks 🙂

Alex Miller (Clojure team)16:07:35

Either the normal core reader fns or clojure.edn reader fns should be able to read tagged literals though with #

Alex Miller (Clojure team)16:07:19

You just need to bind around the call to set up the readers


Ah I see - I did not knew that. So all is fine 🙂 I will go with clojure.spec (s/keys :req-un [...]) for now.