6 ms·
Show HN: Ghostwheel – easy spec, side effect detection and tracing for Clojure
- cutler 8y agoIs it just me or is Clojure(script) becoming more and more syntax-heavy with each passing year?
- lilactown 8y agoI'm not sure what you mean. Clojure(Script) hasn't added any new syntax to the core language in a long, long time.
- grzm 8y agoWould you care to elaborate? Is there something specific you see in this project that caught your eye? One thing I noticed is the use of ligatures, which is becoming increasingly common as editors embrace Unicode more fully, but that's an editor/presentation feature, not something specific to the language. For example: -> → => ⇒ >= ≥ I've seen an increasing number of people trying out Fira Code, which includes a nice set of such ligatures: https://github.com/tonsky/FiraCode https://github.com/tonsky/FiraCode
- gnl 8y agoThe font in the screenshots with the ligatures is in fact Fira Code and the font in the REPL screenshots without ligatures is Ubuntu Mono. I guess those could be considered additional syntax, but they're also completely optional and interchangeable with the corresponding, more Clojure-like keywords.
- grzm 8y agoYeah, I wouldn't consider them syntax, either. There's a lot we can do to make our coding environments easier to work in, and that's independent of the source code itself. I'm glad to see more exploration in this space.
- yen223 8y agoA subtle advantage of having a macro system is that you only pay the price of having unconventional syntax if you opt into it. You can keep the core language small and push weird syntax into macros, which can be imported like libraries. The core language of Clojure is pretty small and simple compared with most other languages.
- gnl 8y agoWhile that is true of the basic building blocks of the language, clojure.spec for example does have an overly verbose syntax (I would define it that way, even though it doesn't introduce new basic syntax elements) for function specs and that was one of the main motivations for writing Ghostwheel. I wouldn't see this as some sort of development in Clojure though and I don't really know if that's what cutler meant anyway. Maybe he'll elaborate.
- gnl 8y agoFellow 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.
- kimi 8y agoI am not sure about the Quick Fix thing in Cursive. Care to elaborate?
- gnl 8y agoWhen 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.
- yogthos 8y agoI wrote a post on the topic here https://yogthos.net/posts/2017-10-03-MovingForwardByLettingGo.html 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.
- 8y ago
- pka 8y agoThis looks promising, can you expand on how this differs from clojure.spec and core.typed?
- gnl 8y agoThis is basically generative testing using clojure.spec in a nice package with a cherry on top and a few extras. core.typed still seems to be quite experimental and not yet production-ready, but it certainly looks very promising and I'm keeping an eye on it. It currently also doesn't work on ClojureScript, which has been the primary platform for Ghostwheel so far.
- badsavage 8y agoCool, will try it out!