Fork me on GitHub
#clojure-spec
<
2019-11-04
>
acron10:11:58

Is there a preference to using either s/* or s/coll-of when we just want 'a collection of x`? I realise coll-of has more tuning, but besides that, is there difference between (s/* ::foo) and (s/coll-of ::foo) ?

jumar10:11:37

Probably the most visible difference will be when you're nesting them - the regex based specs will make it work like it was "flattened" => I'd normally use coll-of; see also http://stackoverflow.com/questions/58636813/i-cant-understand-the-following-clojure-spec-error/58637063

acron10:11:02

Thanks, I think for sanity sake then I will ask for coll-of in these situations

alexmiller12:11:25

Yes, should use coll-of by default

👍 4
manutter5120:11:17

Hmm, I thought this would work:

(s/fdef page-header-ribbon
        :args (s/cat :title string? :extra (s/* any?))
        :ret vector?)

(page-header-ribbon "Manage Users") 
but I get
Call to #'page-header-ribbon did not conform to spec:↵
val: "Manage Users" fails at: [:args] predicate: (cat :title string? :extra (* any?))...

manutter5120:11:20

What am I doing wrong?

alexmiller20:11:24

is there more to that ... ?

manutter5120:11:50

Just the rest of the stack dump stuff, the JS objects etc

manutter5120:11:38

Call to #'page-header-ribbon did not conform to spec:↵
val: "Manage Users" fails at: [:args] predicate: (cat :title string? :extra (* any?))↵
:cljs.spec.alpha/spec  #object[cljs.spec.alpha.t_cljs$spec$alpha44661]↵
:cljs.spec.alpha/value  "Manage Users"↵
:cljs.spec.alpha/args  "Manage Users"↵
:cljs.spec.alpha/failure  :instrument

alexmiller20:11:11

at a glance it doesn't look wrong to me

manutter5120:11:17

Ok, good, I’m not nuts then.

manutter5120:11:27

Probably some kind of dependency conflict or something.

alexmiller20:11:55

I couldn't repro in either clj or cljs. maybe old repl statee?

manutter5120:11:51

It’s surviving multiple shutdown/clean/restart cycles. 🤷

alexmiller21:11:07

in case that's different than what you're doing...

manutter5121:11:57

Not [cljs.spec.alpha :as s]?

alexmiller21:11:46

either should work

alexmiller21:11:56

the clojure one aliases to the cljs one