This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-05-09
Channels
- # announcements (23)
- # babashka (7)
- # beginners (69)
- # biff (5)
- # calva (12)
- # cider (10)
- # cljfx (9)
- # clojure (60)
- # clojure-austin (1)
- # clojure-europe (14)
- # clojure-korea (2)
- # clojure-losangeles (2)
- # clojure-madison (1)
- # clojure-nl (1)
- # clojure-norway (23)
- # clojure-uk (7)
- # clojuredesign-podcast (16)
- # clojurescript (40)
- # datomic (8)
- # gratitude (4)
- # mount (3)
- # nrepl (2)
- # off-topic (38)
- # pathom (3)
- # releases (1)
- # ring (8)
- # shadow-cljs (7)
I have never seen :keys
destructuring using actual keywords. I had expected to see symbol names like replace-existing
.
I guess I am wondering why, and how does it work.
(defn move
"Move or rename a file to a target dir or file via `Files/move`."
[source target {:keys [:replace-existing
:atomic-move
:nofollow-links]}]
https://github.com/babashka/fs/blob/5da99ed3f32fbb4a49aa4119653b5a065aa8d345/src/babashka/fs.cljc#L636-L638it works the same as symbols there, which really doesn't buy you anything except that you can leverage keyword :: autoresolve to more easily get qualified keywords (as no equivalent for autoresolved qualified symbols)
that's why that support was added
but since then, we now support namespacing on :keys itself (`::keys`, ::alias/keys
, :qualified/keys
) which has the same effect on the symbols within, and that is preferred
💡 1
💯 1
thanks for the explanation 🙏