This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-30
Channels
- # aleph (25)
- # announcements (20)
- # babashka (29)
- # babashka-sci-dev (12)
- # beginners (27)
- # biff (3)
- # clojure (29)
- # clojure-europe (21)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojurescript (3)
- # clr (5)
- # code-reviews (4)
- # data-science (7)
- # datahike (6)
- # datascript (3)
- # emacs (9)
- # fulcro (5)
- # graalvm (10)
- # malli (15)
- # nbb (7)
- # off-topic (17)
- # pathom (9)
- # polylith (4)
- # practicalli (15)
- # reitit (3)
- # releases (2)
- # rum (1)
- # shadow-cljs (73)
- # squint (34)
- # tools-deps (3)
- # xtdb (11)
How is everyone finding the smart-map in Pathom3? I find myself reaching for p.eql/process
mostly. The smart-map just seems kinda gimmicky. Would love to hear from people that use it more.
hello Caleb, I personally haven't used it much either
I can imagine some interesting usages when interfacing with things that require maps
one idea I have for instance, is for a compatibility layer between Pathom 2 and 3, where a Pathom 2 plugin for instance can receive an env that's a smart map, that can respond to Pathom 2 env keys, translating to Pathom 3 keys
Ah that’s interesting. For smaller things it could be useful. One project I’m working on isn’t using Pathom at all. We have a data structure that we’ve began refactoring by renaming some keys with improved namespaces & names. Also small structure changes. All new keywords however to avoid breaking changes. What we will essentially have is the old and new data structures merged together. I could wrap the data structure in a smart map with resolvers providing bidirectional conversion for old keywords to new keywords. It’s a very cool solution to this compatibility problem. However, there may be situations where transformative code might take the smart map and return a regular map. Also when sending smart maps through legacy code, developers reading the code won’t have any idea they’re dealing a smart map unless they know before hand.
yup, all you said is correct, I add one caveat to the "However, there may be situations where transformative code might take the smart map and return a regular map.", this is a config on smart maps, by default, any map (or sequence of maps, including sets) will get automatically wrapped to become a smart map too (check: https://github.com/wilkerlucio/pathom3/blob/98098d2827fa3f14aab6ee5e7c265cb3db4c94bb/src/main/com/wsscode/pathom3/interface/smart_map.cljc#L79-L101)
you can set ::psm/wrap-nested? false
(in env) to disable this behavior
Thanks!
I haven't been using them at all