Fork me on GitHub

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]


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.


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


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


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)


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.


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.


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.


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


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