On Sat, Dec 20, 2008 at 3:49 AM, Rowdy Rednose <rowdy.redn...@gmx.net> wrote: > > Validators seem like an easy way to do it, I'll try that. Thanks > Chouser!
Just a caution. Validators can run even if the ref does not change. For instance when a transaction is aborted by another validator. > > Afaik Rich only thinks about adding watchers to refs currently, and I > can't find it in the list: > http://code.google.com/p/clojure/issues/list?can=2&q=&colspec=ID+Type+Status+Priority+Reporter+Owner+Summary&cells=tiles > > So it will probably not be in 1.0 > > On 20 Dez., 11:30, Chouser <chou...@gmail.com> wrote: >> On Fri, Dec 19, 2008 at 8:35 PM, Rowdy Rednose <rowdy.redn...@gmx.net> wrote: >> >> > Apart from being blasphemous - would it be a good idea to override >> > clojure.lang.Ref in Java land? >> >> > I want to create (children of?) refs in clojure that send an agent >> > when they change, so that I can create facilities to observe changes >> > to them. >> >> I don't think it would be quite that easy. The implementation of Refs >> is shared with LockingTransaction. >> >> You saw that agents have watchers that do exactly this? Depending on >> how complex your use case, you might be able to get away with using >> agents and 'await' for now. >> >> Another option, as long as you don't tell Rich, is that you could >> abuse the validator function to send to your agent. >> >> Anyway, apparently watchers for Refs are planned, so you could just >> wait for that. >> >> --Chouser > > > -- Venlig hilsen / Kind regards, Christian Vest Hansen. --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---