Open
Description
Hi,
Would like to have better support for namspaced keys in fnk-destructuring. Current status:
(= 1 (plumbing.core/letk [[a/b] {:a/b 1}] b))
; => true
which is great, but would like to support using namespaced keys for clarity as Clojure core support this:
(= 1 (let [{:keys [:a/b]} {:a/b 1}] b))
; => true
.. so, would like this to work:
(= 1 (let [[:a/b] {:a/b 1}] b))
; CompilerException java.lang.Exception: Unsupported binding form: :a/b
This would open open up the interoperability to clojure.spec
as one could mix and match spec & schema annotations.
(defnk use-schemas [x :- s/Int, y :- s/Int] (+ x y))
(clojure.spec/def ::x integer?)
(clojure.spec/def ::y integer?)
(defnk use-spec [::x, ::y] (+ x y))
(defnk use-schema-and-spec [::x, y :- s/Int] (+ x y))
With current plumbing schema extraction helpers and a lookup to the clojure.spec registry, it one can post-resolve (on the client code) the types for namespaced keys. With a separate mapping of schema predicate to spec, one could also generate either typed schemas using specs or (maybe) specs using the schemas.
Metadata
Assignees
Labels
No labels
Activity