On Mon, Jan 7, 2019 at 5:26 PM Herwig Hochleitner <hhochleit...@gmail.com> wrote:
> Am Mo., 7. Jan. 2019 um 11:20 Uhr schrieb Oleksandr Shulgin < > oleksandr.shul...@zalando.de>: > >> >> Is it intended that calling `await` on an agent triggers the watch >> functions? >> >> 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. >> >> I don't think that this behavior is explicitly intended, but I don't > think that it's faulty either. > > I'd argue that any watcher function should be robust towards being > triggered without changes: > > 1) (send a identity) should always be a no-op without any hidden > implications. That's important, so that any agent function will be able to > decide to do nothing. > I understand and agree with that. I also see that the add-watch documentation says that the watch functions are called "whenever the reference's state *might* have been changed", but I just wonder if this is worth documenting. Unless it's considered to be merely an implementation detail which is subject to change. Thanks, -- 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.