This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-23
Channels
- # announcements (2)
- # architecture (83)
- # asami (2)
- # babashka (49)
- # bangalore-clj (2)
- # beginners (235)
- # braveandtrue (1)
- # calva (17)
- # clojure (109)
- # clojure-australia (5)
- # clojure-czech (5)
- # clojure-dev (24)
- # clojure-europe (17)
- # clojure-germany (2)
- # clojure-nl (3)
- # clojure-serbia (13)
- # clojure-spain (1)
- # clojure-spec (1)
- # clojure-uk (20)
- # clojurescript (3)
- # community-development (34)
- # conjure (10)
- # cursive (21)
- # data-science (1)
- # datahike (1)
- # datalog (1)
- # datomic (12)
- # etaoin (3)
- # events (2)
- # fulcro (13)
- # graphql (8)
- # heroku (2)
- # lsp (58)
- # malli (32)
- # membrane (24)
- # off-topic (63)
- # parinfer (2)
- # pathom (14)
- # portal (14)
- # re-frame (16)
- # reagent (50)
- # releases (1)
- # rum (1)
- # shadow-cljs (10)
- # sql (6)
- # startup-in-a-month (1)
- # timbre (2)
- # tools-deps (61)
- # xtdb (4)
I had an idea for a deftype improvement (https://ask.clojure.org/index.php/10369/add-atomic-field-updaters-to-deftype) which may be of interest to people here, but also may be pretty niche (the small set of people who use deftype, who use volatile-mutable, who want atomic updates)
This question would be much rather if you wrote it as "I have problem X, one possible solution is Y" rather than "Add Y" (Ghadi's questions below signify perhaps several possible other solutions as well)
The question does hint at all at why you want this or how it would be used with which we could compare possible solutions
I thought that this: > I have been playing with implementing some alternative concurrency constructs in Clojure which ends up using a lot of atomic reference fields. It is easy enough to just wrap an atom around all these things, but that introduces an extra object and layer of indirection. was that
should it just not mention AtomicReferenceFieldUpdater at all and just say "the jvm lighter weight ways to do cas on fields, it be would be nice to expose"?
Mentioning ideas is fine, just start with what you’re trying to do
What problem is the alternative concurrency construct trying to solve? Why don’t the existing suffice?
Yeah looks interesting I hadn't seen them before, the api there is certainly clunkier to use from clojure(all those java varargs)
Seems like a huge hassle then, I just want to cas on type fields without having to do weird hacks to construct the updater once in a context that can access the field
Memory overhead both just in terms of more objects but also in terms of pointer chasing
https://gist.github.com/6c111db73ac020e1a234e0361e2e067a is an example of the hack I have now (adding a 0-arg invoke method to build the updater and return it)
and I totally forgot about the double layers function call hacks because the repl really likes to invoke all functions using apply