Fork me on GitHub

Hi all! Is anyone else getting errors like Call to clojure.core/ns did not conform to spec? I'm working on a clj/s project and I want to use spec with reframe. I've tried the latest version of clojure (`1.9.0-alpha16`) and I get the aforementioned error. However, when I move the dependency to 1.9.0-alpha10 the error does not occur. Any idea for the change? BTW This is my first attempt at using a clojure alpha version, and I have many dependencies that may be incompatible (I feel that this is unlikely in this case, though correct me if I'm wrong). If needed I can provide more information.

Alex Miller (Clojure team)00:05:47

The namespaces for spec just changed in alpha16 and cljs and other deps are not compatible with it

Alex Miller (Clojure team)00:05:05

You might want to fall back to alpha15


I actually tried every alpha from 16 to 10, and 10 was the first one that worked.

Alex Miller (Clojure team)00:05:33

What's the actual error you're getting?

Alex Miller (Clojure team)00:05:18

Many libs had bad ns deps - most of those have been fixed and newer versions exist


I put a gist up: How can I tell where the error is originating from? I see that it likely is from (onelog/core.clj:1:1), but I don't know where that is, (probably in timbre though, I'll see if I can bump that version up).


Onelog is part of ring apparently part of ring-middleware-logger. I'm currently using the latest of both. So, is the issue not with clojure itself, but with onelog? If that's the case, I'll see about a pull request/issue to them.


So, after crawling through the error message more thoroughly, it appears that onelog is using the syntax (ns ... (:import (com.something SomeClass))). Spec changed something about ns with -alpha11, and it was already reported to them Thanks for the help!

Drew Verlee02:05:36

Apologies as this has probably been asked a dozen times, but does clojurescript current support generators?


@drewverlee not that I know of, but generators tend to encourage a impure code. Most of what you would need generators for can be done with more functionally pure constructs like map, filter and for.


@alexmiller So if I want to use alpha16 and have cljs in my project I should wait for a compatibility patch or something similar?


@tbaldridge I think @drewverlee is referring to the test.check kind of generators, given that he's asking in here 🙂 @drewverlee test.check supports cljs at least, not sure if clojure.spec's wrapping of it works with cljs, though.


With the announcement of spec moving to its own lib, I see that spec.alpha is under org.clojure, but nothing like org.clojure/clojurescript.spec.alpha? Has it not moved yet?


alrighty, thanks


what’s a good example of adding validation on a macro?


what do you want to validate?


actually, might need to rethink this


I have a wrap-error macro that takes a map of context data and a body.

(defmacro wrap-error [args & body]
  (let [e (gensym 'e)]
    `(try [email protected]
          (catch Exception ~e
            (log-error! ~e ~args)
          (catch Error ~e
            (log-error! ~e ~args)
I want to make sure that the macro user doesn’t forget to pass in the context map, because if so, the first line of the body wouldn’t get executed. but I’m not sure it’s possible to do that at compile time


what context map?


you mean you want to validate args?


no way to do this without a macro?


you want to use spec to validate args? add a clause to your let?


sorry let me try a better explanation. I want people to use this macro like this:

(wrap-error {:some :data :a 1 :b 2} ...body...)
where the first argument is some metadata to associate with the error, if there is one. the macro has been used mistakenly like this:
(wrap-error ...body...)
without the first arg, resulting in incorrect behavior because the first element of body is interpreted as the metadata and not executed. was wondering if there was a way to use spec to prevent this at read-time. less about validating the metadata itself so much as the presence of it.


might be hard to distinguish at read-time though. i wonder if this has to be a run-time check (`(s/valid? map? args)`)