aleph

jcf 2017-07-18T10:24:41.118846Z

@lvh I've heard from Cognitect team members that they use spec for the pure side of things, and not IO-bits and bobs. I suppose in this case that would mean specifying what happens inside the deferred operation and not the delayed (maybe IO?) side of things. I think https://clojure.org/guides/spec#_combining_code_check_code_and_code_instrument_code may be a good example of how to split the specification and deferred/side of things?

jcf 2017-07-18T10:24:51.122198Z

HTH.

lvh 2017-07-18T13:51:11.821220Z

@jcf Yep; thanks 🙂 I guess I can just write my assertions on the first pure fn 🙂

lvh 2017-07-18T13:51:31.833812Z

I find spec to still be quite useful for the deferred side because stubbing

jcf 2017-07-18T13:52:52.883538Z

@lvh that makes sense. I've struggled with specifying Datomic in the past and ended up only annotating the pure transaction building bits etc.

lvh 2017-07-18T13:55:09.967293Z

wait; are they hard because they’re impure, or hard because some things are wrapped in a deferred

lvh 2017-07-18T13:55:38.985554Z

I thought it was strictly the latter; it may be wrapped in a deferred but I still have Strong Opinions(TM) about what the value inside that deferred will get to look like

jcf 2017-07-18T22:35:05.230920Z

@lvh I don't know about things being hard, but if you're dealing with executors and thread pools specs may not be appropriate?

lvh 2017-07-18T22:35:46.243641Z

the stubbing affects the var itself so executors and thread pools get sidestepped entirely

lvh 2017-07-18T22:35:59.247649Z

of course, that enables plenty of cases where e.g. you’d have a livelock in prod that doesnt’ show up in testing

jcf 2017-07-18T23:10:38.854801Z

If you're cutting out the threads you can cut out the deferreds too I suppose. You're right though. Effectively ignoring what is a big part of the production code path isn't going to necessarily end well.

jcf 2017-07-18T23:11:21.866281Z

Maybe happy-path integration tests and/or some simulation testing would fill that gap if budgets/constraints allow.