also: defs, java fields, agents
The clojure website has documentation for these concepts:
I understand the words, but I don't conceptually get the purpose / meaning of these. When should I / how can I know when to use them?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.
Sign up to join this communityalso: defs, java fields, agents
The clojure website has documentation for these concepts:
I understand the words, but I don't conceptually get the purpose / meaning of these. When should I / how can I know when to use them?
EDIT
The links you posted are highly important to read, however I also recommends this: Software Transactional Memory
Keep in mind that aborted transactions will be replayed. What does this mean?
It means that the code inside dosync could be executed a couple of times, so you need to be careful the code should be side effects free.
One use of agents is to have a controlled side effects. Consider this:
(dosync
(send log-agent message args)
(alter reference function))
The STM will hold all of the actions needed to be sent to agents until succeed.
What is difference between atoms and agents?
Updates to agents will happen asynchronously at some point of the future, updates to atoms will happened immediately.
Atoms and agents don't need to run inside a transaction, refs should be (coordinated changes, remember?)