This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-10
Channels
- # announcements (4)
- # babashka (29)
- # beginners (15)
- # calva (4)
- # cljs-dev (1)
- # clojure (28)
- # clojure-dev (13)
- # clojure-europe (3)
- # clojure-india (1)
- # clojure-spec (7)
- # clojure-uk (5)
- # clojurescript (37)
- # component (2)
- # conjure (60)
- # cursive (2)
- # datomic (1)
- # emacs (1)
- # figwheel-main (18)
- # fulcro (38)
- # graalvm (6)
- # graphql (13)
- # helix (14)
- # jobs-discuss (1)
- # joker (5)
- # lein-figwheel (2)
- # nrepl (3)
- # off-topic (15)
- # other-languages (1)
- # other-lisps (1)
- # pedestal (2)
- # reagent (8)
- # reitit (44)
- # shadow-cljs (83)
- # slack-help (8)
- # spacemacs (1)
@vlaaad As I see vswap!
is implemented as macro just to assign the type hint to volatile and avoid reflection on .reset
and .deref
invocations
> Prints "1" twice looks like it is not designed to work with volatiles which you cannot access directly 🙂
well, only @alexmiller can answer if he remembers 🙂 https://clojurians.slack.com/archives/C06E3HYPR/p1589057208146700
the discussion in the comments seems to be derailed because of :inline
in the patch...
Actually, I thought I have a problem, but I'm not. I had a volatile in a map, and wanted to update value inside the volatile like that (update my-map :volatile vswap! my-other-fn)
, but that was a mistake since vswap!
returns a value, not a volatile
Just use an atom, you get a function for swap and as a bonus it is race free under contention, volatile is not
Actually, I thought I have a problem, but I'm not. I had a volatile in a map, and wanted to update value inside the volatile like that (update my-map :volatile vswap! my-other-fn)
, but that was a mistake since vswap!
returns a value, not a volatile