ghostwheel

Hassle-free clojure.spec, automatic generative testing, side effect detection, and evaluation tracing for Clojure(-Script) – https://github.com/gnl/ghostwheel
Geoffrey Gaillard 2018-07-01T15:34:48.000021Z

Hello ! Taking the liberty to create a channel for https://github.com/gnl/ghostwheel for the following reasons: - Even in alpha Ghostwheel is useful, I have an internal library targeting the exactly same goals and it serves us well - Clojure does not enforce purity and spec can be tedious, Ghostwheel seems to be a good approach to making Clojure code safer, more documented, and easier to work with in a team, without relying on static type checking - This is not the first time someone try to enhance defn to provide documentation and assertions : - standard :pre and :post, - clojure.spec.alpha/fdef with :args, instrumenting only :args, - orchestra, checking also :ret and :fn, - clojure.core.typed/defn adding type annotations - defn-spec, etc … so a lot of clojurians seems to need to make their functions safer. Since Ghostwheel is in alpha and is missing some features (IMHO), I think we have a lot to talk about πŸ™‚

❀️ 1
gnl 2018-07-01T15:42:39.000013Z

@ggaillard I thought about creating a channel but decided to wait until I knew how much interest Ghostwheel would generate. At this point it does seem like it might make sense, so thanks for that. πŸ™‚ Regarding missing features - I am certainly open to feedback and interested in making it more useful, but do keep in mind that my top priority is to keep it focused, simple and easy to use, so my main focus at the moment is to make sure that what's already there is as stable, polished and cross-platform as possible.

gnl 2018-07-01T15:44:12.000069Z

What I'm saying is that even a new configuration option has to really make sense to me to be considered for inclusion.

gnl 2018-07-01T15:45:09.000016Z

Hope that doesn't scare anyone off though, I'm open to hearing any and all ideas πŸ™‚

Geoffrey Gaillard 2018-07-01T16:07:07.000034Z

Totally makes sense. About the interest, I'm a simple Clojure developer: I want to write simple yet robust and composable code that is easy to read and easy to reason about. And I don't want to reimplement features both on the server, the client and want to write as few unit tests as possible, because it cost me time and money to maintain them. I tried to implement something like Ghostwheel a few time ago, I was walking namespaces to find functions with annotations like : - :pure flagging the function as pure, - :mock providing a way to mock the function using a constant value, a function or a spec, - :transform allowing to transform the mocked result according to the function's arguments But I didn't took the time to detect side-effects, spent too much time on mocking, and not enough on specs. In the end my library was nice to check pure functions, but most of my codebase consist of side effects (external APIs, CRUD and async events).

Geoffrey Gaillard 2018-07-01T16:14:25.000046Z

I don't think my needs are any special and a lot of clojurians might need the same πŸ™‚ I struggled a lot with Promises, because clojure is dynamic and promises behave like an Either monad, you have to Β«open the boxΒ» or deref it to be able to check if it contains a Left error or a Right result. But deref-ing a promise makes the derefer thread block. Same goes for core.async channels. So your program is not really asynchronous anymore when you instrument it πŸ˜•

gnl 2018-07-01T16:18:31.000044Z

I'll have to go now, so quick answer and we can discuss the rest another time – making side-effectful functions easily testable and mockable/stubable is the one area where I see Ghostwheel getting new features, so totally with you there.

gnl 2018-07-01T16:19:43.000037Z

I think there's even something in the readme along those lines, so things are definitely headed in that direction.

gnl 2018-07-01T16:21:16.000063Z

Thanks again for creating the channel, we'll talk more about this next time