3 ms·
For Clojure, check out Ghostwheel [1] - a lightweight DSL for writing specs. If you want proper static typing though, ReasonML might be a good choice. Static,
by pka 8y ago
For Clojure, check out Ghostwheel [1] - a lightweight DSL for writing specs.
If you want proper static typing though, ReasonML might be a good choice. Static, compiles to js and native, super easy to learn, and there’s an experimental Lisp frontend with Clojure-like syntax if you can’t live without paredit.
[1] https://github.com/gnl/ghostwheel https://github.com/gnl/ghostwheel
- hellofunk 8y agoTo me, core.spec has valid uses, but not as a replacement for static tying.
- pka 8y agoI agree, but it’s the best you can get if for some reason you’re stuck with Clojure.
- gnl 8y agoAuthor of Ghostwheel here – clojure.spec is certainly not a replacement for static typing, but it goes a long way to covering many of the same use cases, in fact longer than one might think at a cursory glance. With Ghostwheel you write your function specs similar to how you'd write a type signature and you get automatic generative testing (including higher order function support) and side effect detection which – when combined with spec instrumentation (+ the upcoming evaluation tracing for the test execution) – can often tell you quite precisely where you screwed up in a much more immediate and granular manner than a simple unit test or mucking about in the REPL could. It really is a quite different experience from plain Clojure. That being said, I'd love types in addition to this and I'm keeping a keen eye on ReasonML.