speced.def
speced.def copied to clipboard
Implement a ^::speced/closed-keys directive
Given
(speced/defn
inline-function
[^::speced/closed-keys {:keys [foo bar baz] :as x}]
(when (< 0 x 100)
(-> x (* x) str)))
, ^::speced/closed-keys
would ensure that the map x
only has the destructured keys, without extra ones.
The directive should be non-recursive, and if possible the :as
destructuring should be used, for clearer error reports (vs. gensym)