ghostwheel

Hassle-free clojure.spec, automatic generative testing, side effect detection, and evaluation tracing for Clojure(-Script) – https://github.com/gnl/ghostwheel
genekim 2018-09-30T20:05:56.000100Z

@clojurians.net Touching an area of a reframe app that I wrote long ago, and was bitten by typing error that took 15m to find and fix. Is there an obvious way to use ghostwheel for re-frame event handlers? (I'll post example of one in a couple of minutes...) Thank you! (This is an area where I tend to screw up quite a bit!)

genekim 2018-09-30T20:17:37.000100Z

Example of an anonymous function in re-frame event handler -- is there any way to use ghostwheel to type check these? What has bitten me lately: strings vs ints vs maps, just in the "callers" and "callers" to this one event handler! ( I made "hk" a map, I found to my chagrin last night! :) @clojurians.net

genekim 2018-09-30T20:32:11.000100Z

Whoa. Just read this. What a marvelous shorthand for nilable!!! @clojurians.net

👍 1
🙂 1
genekim 2018-09-30T20:49:14.000100Z

@clojurians.net upon some thinking, I'm guessing supporting anonymous functions is probably not a great thing for ghostwheel -- I'll try using the more standard :pre assert notation on those functions, and definitely increasing the documentation I use on non-typical arg types, to preventing surprising myself months from now!!! :)

gnl 2018-10-01T15:50:10.000100Z

Hey @genekim , support for anonymous functions wouldn't work too great for a number of reasons, but it's also not really needed – my recommendation for now is to use named functions:

(>defn foobar ...)
(re-frame/reg-event-fx :something/foo foobar)

gnl 2018-10-01T15:53:20.000100Z

You might want to optimise this with some macro, some support for which is coming with the next Ghostwheel release.

genekim 2018-10-01T16:02:56.000100Z

@clojurians.net Ah! That looks terrific -- and of course, I'm slapping myself on the forehead that I didn't think of that... Especially since for months, I've been wanting to pull out some of these anonymous functions to write some automated tests to confirm correct functionality of some of the more fiddly ones. I'll surely get cracking on my first one today! :) (Seems more fun than all the urgent stuff I should be working on! :)

gnl 2018-10-01T16:03:52.000100Z

It's called 'productive procrastination' and it can move mountains. 😄