Skip to content

Commit b4e9727

Browse files
committed
Update README with more comparisons to similar projects
1 parent 25ea218 commit b4e9727

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,27 @@ The basic syntax is the same as `clojure.core/defn`, but you can optionally add
6666
)
6767
```
6868

69+
The API is very minimal, there is just a single `defn` macro in the public API.
70+
6971
## Limitations
7072

7173
* Multiple arity functions are not yet supported. [#2](https://github.com/danielcompton/defn-spec/issues/2)
7274
* `& rest`, `& [a b]`, and `:keys` destructuring are not yet supported. [#3](https://github.com/danielcompton/defn-spec/issues/3), [#4](https://github.com/danielcompton/defn-spec/issues/3), [#10](https://github.com/danielcompton/defn-spec/issues/10)
7375
* `:fn` specs are not supported yet, as I'm not sure where to put the `:fn` spec yet. [#6](https://github.com/danielcompton/defn-spec/issues/6)
7476
* ClojureScript is not supported yet. [#7](https://github.com/danielcompton/defn-spec/issues/7)
75-
* Using an attr-map after the function definition is not supported. I've never seen this used in the wild, and didn't even know this was a thing until investigating the `defn` macro.
77+
* Using an attr-map after the function definition is not supported. Looking at defn's docstring: `(defn name doc-string? attr-map? ([params*] prepost-map? body) + attr-map?)` it is the final `+ attr-map?` that isn't supported. I've never seen this used in the wild, and didn't even know this was a thing until investigating the `defn` macro.
7678

7779
## Motivation
7880

7981
I've been using Clojure spec for a while, but I found that I often resisted writing specs for functions. This was mostly because I didn't want to have to duplicate a bunch of information into the `fdef`. It's not a huge deal, but in my experience it was enough to deter me from writing specs while I was heavily working on an area of code. I created defn-spec to increase the locality of the spec definitions, and to reduce the activation energy to start adding specs to your codebase.
8082

81-
This is similar to Orchestra's [defn-spec](https://github.com/jeaye/orchestra#defn-spec) macro, but allows for optionally only speccing part of the function, and matches the well-known Schema defn syntax. Try them both out though, and see which one works best for you.
83+
## Alternatives
84+
85+
* Orchestra has a [defn-spec](https://github.com/jeaye/orchestra#defn-spec) macro. The net.danielcompton defn-spec allows for optionally only speccing part of the function, and matches the well-known Schema defn syntax.
86+
* [Ghostwheel](https://github.com/gnl/ghostwheel) has a defn macro. It also introduces a new way of describing specs. This project tries to not introduce any extra concepts for defining specs, apart from the ability to add spec hints to arguments.
87+
* [Provisdom/defn-spec](https://github.com/Provisdom/defn-spec) is more focused on instrumenting functions. It does allow inline definitions of specs, though the syntax is much the same as in an `fdef`.
88+
89+
Try them all out though, and see which one works best for you.
8290

8391
## Benefits and tradeoffs
8492

@@ -110,7 +118,7 @@ This library is currently in alpha preview and is soliciting feedback on functio
110118

111119
defn-spec-alpha follows clojure.spec.alpha. When clojure.spec-alpha2 is released, the plan is to publish a new artifact ID and set of `defn-spec-alpha2` namespaces, so you can use both versions side-by-side as you migrate to spec-alpha2.
112120

113-
Long-term I would like `defn-spec` to be so stable that it is safe to include as a library dependency. While I strongly want to keep source compatibility, I can't guarantee this in the short-term. Until this warning is removed I would recommend only using this in applications or libraries where you control all of the consumers. There have also been rumblings that eventually there may be something similar to this built into Clojure's core defn macro.
121+
Long-term I would like `defn-spec` to be so stable that it is safe to include as a library dependency. There is only a single macro in this library to minimise the risk consumers are taking on. While I strongly want to keep source compatibility, I can't guarantee this in the short-term. Until this warning is removed I would recommend only using this in applications or libraries where you control all of the consumers. There have also been rumblings that eventually there may be something similar to this built into Clojure's core defn macro.
114122

115123
## Cursive integration
116124

0 commit comments

Comments
 (0)