This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-02
Channels
- # ai (5)
- # announcements (1)
- # babashka (8)
- # beginners (16)
- # clojure (21)
- # clojure-europe (3)
- # clojure-norway (6)
- # clojure-uk (1)
- # datomic (3)
- # events (4)
- # figwheel-main (5)
- # fulcro (10)
- # jobs (1)
- # lsp (26)
- # missionary (5)
- # pedestal (1)
- # polylith (3)
- # portal (28)
- # practicalli (1)
- # reagent (37)
- # reitit (1)
- # scittle (24)
- # tools-deps (7)
This is a beginner question, but what exactly does Clojure missionary do that atom watchers don't? It sounds like it essentially allows you to react to atoms with the option of cleaning up the watcher later. Is that the gist of it? Like, couldn't you just attach a watch to an atom updates another atom?
The goal of this lib is not to "watch atoms" 😀 May I suggest you to take the time to dig deeper. Read the https://github.com/leonoel/missionary/blob/master/README.md, read https://github.com/leonoel/missionary/tree/master/doc/tutorials, follow https://github.com/leonoel/missionary/wiki/Basic-Walkthrough:-Tasks-&-Flows.
I was not saying it's for watching atoms, but that the examples given revolve around having variables that respond to atom changes in a reactive way. Which can be done by adding a watch that updates another atom.
What is the point of any Clojure library? It is to make your coding life easier, to give you syntax, abstractions and tools to manage what you want to do. Same with missionary, it's a library that exposes syntax and tools in order to define, manage and compose "effects". It exposes abstractions to reason about "effects" usage in your code. You can of course build a hierarchy of watchers by yourself and react to atoms changes. Will it be easy to manage, easy to compose? Documentation examples are narrow on purpose to give a taste of what missionary can provide. Don't be distracted by their simplicity, what is to grasp is beyond 😉
the other major problem solved by missionary is transactional updates - if you try to implement the example from the readme with atom and watches, you will observe inconsistent states aka glitches. It happens when an effect is run in reaction to a change before all the dependencies of this effect have been updated, missionary publishers make sure it's never the case