This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-06
Channels
- # announcements (16)
- # aws (9)
- # babashka (76)
- # beginners (92)
- # boot (1)
- # cider (18)
- # clara (7)
- # clj-kondo (26)
- # clojure (104)
- # clojure-europe (4)
- # clojure-nl (11)
- # clojure-spec (11)
- # clojure-survey (101)
- # clojure-uk (35)
- # clojuredesign-podcast (18)
- # clojurescript (8)
- # core-async (29)
- # data-science (1)
- # datomic (13)
- # emacs (4)
- # fulcro (20)
- # graalvm (14)
- # instaparse (2)
- # jobs (1)
- # juxt (6)
- # malli (5)
- # off-topic (30)
- # onyx (3)
- # planck (1)
- # project-updates (7)
- # re-frame (38)
- # reagent (30)
- # reitit (14)
- # remote-jobs (2)
- # shadow-cljs (50)
- # sql (8)
I'm in the process of writing a version of spec(1) that can be used with babashka. For now it's an interpreted lib:
$ export BABASHKA_CLASSPATH="$(clojure -Sdeps '{:deps {spartan.spec {:git/url "" :sha "104129aae9eab6dd4622937d0f46abeed9c9c537"}}}' -Spath)"
$ bb -e "(require '[spartan.spec :as s]) (s/explain (s/cat :i int? :j string?) [\"foo\" 1])"
"foo" - failed: int? in: [0] at: [:i]
I'm unsure what parts I could be adding to babashka as a built-in. Are there any assurances what parts of the API will be unchanged, and what the future namespace of spec will be ?Why not spec 2? Though not finished, I guess it bears completion (just the last 10% that use 90% of the time :rolling_on_the_floor_laughing:)...
If I have some more assurances, I could adopt parts of this lib as built-ins which would make it much faster.
I can assure you that the future namespace will be different :) The current spec 2 is clojure.alpha.spec
, clojure.alpha.spec.gen
, etc. We're expecting this to eventually be clojure.spec
, clojure.spec.gen
most of the existing spec forms will probably be the same, with some additions and some fine details changing around a few things (and deprecation/removal of s/keys)
most of the spec operations will be the same although we have added arities in all of the conforming ops (valid?, conform, explain, etc) to support spec checking modes
@alexmiller Any sense yet of whether there will a migration path/tooling at launch of clojure.spec
?
hi, I want to use s/fdef
with protocol functions. In one namespace, I'm calling fdef
and defining and implementing a protocol, but the protocol's methods appear to be unaffected by fdef
. If I understand [this issue](https://clojure.atlassian.net/browse/CLJ-2109) right, this is expected behavior. Is that all right, and if so, is there a recommended workaround for speccing protocol functions?
That’s correct - fn specs don’t work with protocol methods. Only workaround I’d suggest is wrapping the call to the protocol function in a method (which I often do as a matter of practice anyways)