Thoughts about fdef utils?
- Dominant language
- Clojure
- Stars
- 606
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
Just wanted to stir up a conversation about this. I personally find specing functions to be tedious for most, simple functions.
Assume we had this spec:
```clojure
(ds/spec ::user {::id spec/uuid?
::age spec/pos-int?
::name spec/string?})
```
Assume we want to spec this function:
```clojure
(defn teenager?
[user]
(<= 13 (::age user) 19))
```
It would be neat if we could somehow spec this function easier
```clojure
(ds/specf teenager?
[::user] ; args
spec/boolean? ; ret
nil ; fn
)
```
Or even with a Schema like macro:
```clojure
(ds/defn teenager? :- spec/boolean?
[user :- ::user]
(<= 13 (::age user) 19))
```
I haven't actually fleshed out any of my thoughts, just wanted to see what you thought about some function specing utilities.
Contributor guide
Research direction
Start by reviewing the proposed ds/specf and ds/defn forms in this issue alongside the existing spec-tools API. Determine the intended scope and semantics for function argument, return, and optional function specs before implementation; the issue does not yet define a concrete done condition.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100