Hacker News new | ask | show | jobs
by gnl 2910 days ago
Fellow Clojurians, I present to you, Ghostwheel.

It makes the writing, reading, refactoring, testing, instrumentation and stubbing of function specs easy; introduces a concise syntax for inline fspec definitions; helps keep track of side effects; and makes general debugging almost fun, with full evaluation tracing of function I/O, local bindings and all threading macros.

It's Alpha software and the Clojure port, while essentially functional, still needs some love to achieve full feature parity with ClojureScript – most prominently missing at the moment is the tracing functionality.

To steal a quote from Nathan Marz' Specter in a blatant attempt at a so far likely undeserved comparison to its indispensability, I like to think of Ghostwheel as clojure.spec's missing piece. It has become quite essential to me and I hope that you will find it useful too.

Feedback, PRs, and issue reports are welcome and much appreciated.

Do your thing, HN.

3 comments

I quite enjoyed the quote in the README, and, of course, the name.

Looks like a great project!

That is certainly a fitting username. Thank you!
This looks great! Is there a way to make it work with existing specced code? I already have a large codebase with lots of fdefs. Can Ghostweel work with them without modification?

Thanks!

At the moment you can set the gspec to nil, but that would simply disable s/fdef generation and all of the spec-related magic. I'm planning to introduce a configuration option with the next release to force Ghostwheel to trust that there's an external s/fdef for that function and still do all the spec stuff.

There may be some limitations on this compared to using inline gspecs – I have to play around with it a bit, but I think it should work fine. Until then, you can still use Ghostwheel for tracing and side effect detection though.

The short answer is "more or less", the longer answer is the second one in the FAQ:

https://github.com/gnl/ghostwheel#faq

I am not sure about the Quick Fix thing in Cursive. Care to elaborate?
When you place the cursor on >fdef or >defn – which Cursive doesn't know what to do with out of the box – a light bulb appears right next to it. This is IntelliJ's quickfix feature for errors it can easily correct. You click it, select 'Resolve as...' and then 'defn'. I think the default shortcut ist Alt+Enter.

EDIT: I'll update the docs to make this clearer.

I wrote a post on the topic here https://yogthos.net/posts/2017-10-03-MovingForwardByLettingG...

Basically, the macro system makes it possible to extend the language in userspace via libraries. This allows the core language to stay small and focused, while different ideas can be tried out as usage patterns change.

The way Clojure is used today is very different from the way it was used a decade ago. However, the language itself has stay remarkably focused over time.