Hello,

Is it intended that calling `await` on an agent triggers the watch
functions?

user> (defn watch1 [& args] (apply println args))
#'user/watch1
user> (def a1 (agent nil))
#'user/a1
user> (add-watch a1 :w1 watch1)
#agent[{:status :ready, :val nil} 0x267236ca]
user> (send a1 (constantly 1))
#agent[{:status :ready, :val 1} 0x267236ca]
:w1 #agent[{:status :ready, :val 1} 0x267236ca] nil 1
user> (await a1)
:w1 #agent[{:status :ready, :val 1} 0x267236ca]
nil
user>  1 1

>From the implementation side I can see why this is the case, but cannot
find if this is documented as intended behavior:
https://github.com/clojure/clojure/blob/ee3553362de9bc3bfd18d4b0b3381e3483c2a34c/src/clj/clojure/core.clj#L3274

For one, it doesn't seem like waiting for an agent involves change in it
state in any way.

Regards,
-- 
Alex

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to