To give some structure to my previous questions - How would I make refs, that I'm interested in, send an agent on every change, without having to do that manually?
A: Extend the Ref class (either in Clojure land or in Java land) B: overload/overwrite (however that would be achieved in Clojure) the relevant functions like ref-set etc. Or is there anything else I missed? On 20 Dez., 10:35, 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. Creating a 'MyRef extends Ref' seems to be the obvious Java > way. Don't know whether the #^clojure.lang.Ref tags in the clojure ref > functions would cause problems, though (is it like instanceof or is it > a (arg.getClass() == ... comparison?). > > This might be the easiest way for a Java developer, but shouldn't it > be possible to develop this in Clojure land in an easy manner? > > On 16 Dez., 20:58, Rowdy Rednose <rowdy.redn...@gmx.net> wrote: > > > Can I listen on changes done to refs? > > > Let's say in a scenario like that > > onhttp://en.wikibooks.org/wiki/Clojure_Programming#Mutation_Facilities > > could I add a facility that allows the registration of listeners that > > get called on certain changes to the refs? > > > For example I'd like to be notified on all changes to employees where > > name is "Jim". --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---