Re: Listen on changes to refs

2008-12-20 Thread Christian Vest Hansen
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

Re: Listen on changes to refs

2008-12-19 Thread Rowdy Rednose
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

Re: Listen on changes to refs

2008-12-19 Thread Rowdy Rednose
Validators seem like an easy way to do it, I'll try that. Thanks Chouser! 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=2q=colspec=ID+Type+Status+Priority+Reporter+Owner+Summarycells=tiles So it

Re: Listen on changes to refs

2008-12-17 Thread Rowdy Rednose
The structure of the wikibook page has changed and that link doesn't work any more. This will: http://en.wikibooks.org/wiki/Clojure_Programming/Concepts#Mutation_Facilities 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

Re: Listen on changes to refs

2008-12-17 Thread Rowdy Rednose
If Rich adds watchers for refs, would watchers be notified inside the transaction? I'm actually trying to get a notification after a transaction successfully finished. Although there might be use cases for firing events inside the transaction. On 17 Dez., 00:37, Stuart Sierra

Re: Listen on changes to refs

2008-12-17 Thread Chouser
On Wed, Dec 17, 2008 at 7:26 AM, Rowdy Rednose rowdy.redn...@gmx.net wrote: Now before I start working on a small and handy framework to handle stuff similar to what's called biz objects / biz models in the java world - has by any chance someone already implemented something in that

Re: Listen on changes to refs

2008-12-17 Thread Rich Hickey
On Dec 17, 2008, at 4:16 AM, Rowdy Rednose wrote: If Rich adds watchers for refs, would watchers be notified inside the transaction? No, only on commit. Rich I'm actually trying to get a notification after a transaction successfully finished. Although there might be use cases for

Re: Listen on changes to refs

2008-12-17 Thread Dave Griffith
I'm actually trying to get a notification after a transaction successfully finished. Well that's easy. Agent sends are buffered in a transaction, and only sent upon successful commit. The coolness of this is hard to overestimate. --Dave Griffith

Re: Listen on changes to refs

2008-12-16 Thread Stuart Sierra
On Dec 16, 7:50 am, Timothy Pratley timothyprat...@gmail.com wrote: SS wrote a cells that works on refs quite a while ago:http://groups.google.com/group/clojure/browse_thread/thread/d79392e4c... Yeah, it works, but the interface is a little awkward. Rich said he wants to add watchers for

Re: Listen on changes to refs

2008-12-16 Thread Timothy Pratley
SS wrote a cells that works on refs quite a while ago: http://groups.google.com/group/clojure/browse_thread/thread/d79392e4c79f8cde/f92eae422e4086c5?lnk=gstq=cells+refs#f92eae422e4086c5 If you search the group for cells you'll find quite a bit of discussion

Re: Listen on changes to refs

2008-12-16 Thread Rowdy Rednose
There must be a smarter way to achieve this than polling the collection for changes, I guess. On 16 Dez., 21:43, Dave Griffith dave.l.griff...@gmail.com wrote: Right now, you add listeners to agents, but not refs. IIRC, there was talk of adding listeners to refs to enable just the sort of

Re: Listen on changes to refs

2008-12-16 Thread Dave Griffith
Right now, you add listeners to agents, but not refs. IIRC, there was talk of adding listeners to refs to enable just the sort of reactive programming you describe, but I don't know the status. --~--~-~--~~~---~--~~ You received this message because you are