Re: Agent watchers on Refs

2009-01-28 Thread Rich Hickey
On Jan 27, 8:49 am, MikeM wrote: > > Were watchers synchronous, they would have to run post-transaction > > (else a watcher action failure could cause a transaction rollback, > > leaving already notified watchers confused). Being post-transaction > > would mean that the refs could have been cha

Re: Agent watchers on Refs

2009-01-27 Thread MikeM
On Jan 27, 10:08 am, Tom Ayerst wrote: > I thought the validator just set "Agent has errors" and you have to check it > explicitly. Vars, refs and agents can have validators. A validator on a ref can prevent the ref from taking on a new value by throwing an exception, which will cause a roll-b

Re: Agent watchers on Refs

2009-01-27 Thread Tom Ayerst
I thought the validator just set "Agent has errors" and you have to check it explicitly. Tom 2009/1/27 MikeM > > > > Were watchers synchronous, they would have to run post-transaction > > (else a watcher action failure could cause a transaction rollback, > > leaving already notified watchers co

Re: Agent watchers on Refs

2009-01-27 Thread MikeM
> Were watchers synchronous, they would have to run post-transaction > (else a watcher action failure could cause a transaction rollback, > leaving already notified watchers confused). Being post-transaction > would mean that the refs could have been changed by another > transaction in the interi

Re: Agent watchers on Refs

2009-01-26 Thread Tom Ayerst
I used a couple of watchers to push model updates onto the EDT in a Swing app; it 'just worked'. I haven't pushed the envelope on it but the abstraction is clear and clean IMHO. Tom 2009/1/26 Rich Hickey > > > > On Jan 25, 4:06 pm, Stuart Sierra wrote: > > Hi Rich, all, > > > > Ever since t

Re: Agent watchers on Refs

2009-01-26 Thread Rich Hickey
On Jan 25, 4:06 pm, Stuart Sierra wrote: > Hi Rich, all, > > Ever since the new implementation of watchers I've been itching to try > out Cells again. It worked great for agents. I ran into a snag, > though, when I tried to make cells out of refs. Here's an example. > > I make two refs: > >

Agent watchers on Refs

2009-01-25 Thread Stuart Sierra
Hi Rich, all, Ever since the new implementation of watchers I've been itching to try out Cells again. It worked great for agents. I ran into a snag, though, when I tried to make cells out of refs. Here's an example. I make two refs: (def r1 (ref 1)) (def r2 (ref (+ 10 @r1))) Add a wat