Fork me on GitHub
#clojure-spec
<
2016-07-26
>
wildermuthn03:07:40

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

wildermuthn03:07:37

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

wildermuthn03:07:42

Might just be my setup.

glv04:07:07

Use the cljs.spec namespace in Clojurescript.

nha16:07:19

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

nha16:07:35

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

nha16:07:45

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