Fork me on GitHub
#clojure-spec
<
2018-05-01
>
dominicm10:05:42

This possibly stems from not knowing when to not apply specs, causing an excess of inappropriate specs. It's easy to assume spec = types, ergo spec all the things [meme]

dominicm10:05:59

I personally struggle at times to know when to, and not to apply certain tools that Clojure provides, and the entire ecosystem even less. e.g. there are still regulars queries about protocols vs multimethods, until recently I reached for protocols more often than I did multi-methods, for no real reason.

mpenet11:05:52

specs "could" be used everywhere in theory, but in practice gen gets in the way (even via instrumentation)

mpenet11:05:35

then if you want to s/check everything you're in for some waiting. not really usable in practice that way either. s/check requires to be more selective

mpenet11:05:35

I personally wish instrumentation would never trigger gen, or at least that we would have the option to disable it without having to dumb down the spec (ex: not having to resort to ifn? for predicates)

seancorfield16:05:51

We tend to spec arguments to APIs, some data structures around the DB (where we can extract the lists of fields to save/update from the specs), core domain data structures, and a handful of functions that interact with those, either across module boundaries, or for certain "critical" domain functions. We try hard not to overuse them because we want to avoid brittleness.

Drew Verlee17:05:45

Whats the ideal way to spec a nested structure? e.g

{:x {:y {:a "hi" :b "bye"}}}
All the examples in the docs are fairly flat data structures. Also most examples assume the key is a key and not a unique value. Which in most cases, it should be, in this case i was modeling a graph and i’m not sure its reasonable/easy to do it that way. In a related vein. I wonder how easy it is to do a depth first search with datalolg and datascript. Which would be another way to go about doing this.

Drew Verlee18:05:46

Yea. After some more thought, its not the nesting thats the issue. Its the fact that my keys are unique in this example. I’ll have to think about if i want to lose some terseness in order to label things more.

tbaldridge19:05:11

graphs are going to be hard to spec completely, you'll need a "any?" in a few places.

tbaldridge19:05:39

spec will consume stack as it traverses the graph, so if you manage to create a really deep graph, or a cyclic graph, you'll have problems validating it