Re: Synchronous watches

2009-03-05 Thread Anand Patil
I've managed to create weird race conditions by adding watches while actions are running. Are there guarantees about the scheduling of actions and adding/ removing watches? If I add or remove a watch on an agent while an action is running, what happens? So to summarize, my feedback that still may b

Re: Synchronous watches

2009-03-05 Thread Anand Patil
Excellent point. Yes, get-watches seems like a better option. Anand On Thu, Mar 5, 2009 at 3:33 AM, Timothy Pratley wrote: > > I forgot to mention the reason I don't feel it should be an error to > remove a non-existent watch > user=> (dissoc {:a 1 :b 2} :c) > {:a 1, :b 2} > > > > > --~--~--

Re: Synchronous watches

2009-03-04 Thread Timothy Pratley
I forgot to mention the reason I don't feel it should be an error to remove a non-existent watch user=> (dissoc {:a 1 :b 2} :c) {:a 1, :b 2} --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post t

Re: Synchronous watches

2009-03-04 Thread Timothy Pratley
> Also, (remove-watch a key) fails to raise an error if a doesn't have any > watches associated with key. Just curious why you would want it to? Might you be equally served with something like (get-watches a) so you can determine if a key is there to be removed? (defn get-watches [#^clojure.lang.

Re: Synchronous watches

2009-03-04 Thread Anand Patil
On Wed, Mar 4, 2009 at 10:35 AM, Anand Patil < anand.prabhakar.pa...@gmail.com> wrote: > > Hi Rich, > > I like the flexibility of the new watches, but I'm missing a way to > watch for errors. Currently, if an agent's action results in an error > its watchers aren't even triggered. > > Thanks, > An

Re: Synchronous watches

2009-03-04 Thread Anand Patil
Hi Rich, I like the flexibility of the new watches, but I'm missing a way to watch for errors. Currently, if an agent's action results in an error its watchers aren't even triggered. Thanks, Anand On Feb 27, 2:57 pm, Rich Hickey wrote: > I've added (back)synchronouswatches(svn 1309+), which us

Re: Synchronous watches

2009-03-01 Thread Stuart Sierra
On Feb 27, 9:57 am, Rich Hickey wrote: > I've added (back) synchronous watches (svn 1309+), which used to exist > for agents, now for all reference types. Cool. I won't have much time to play with this until next week, but I look forward to experimenting with it.

Re: Synchronous watches

2009-03-01 Thread mikel
On Feb 27, 8:57 am, Rich Hickey wrote: > I've added (back) synchronous watches (svn 1309+), which used to exist > for agents, now for all reference types. [...] > Please try them out for your latest Cells-like and other reactive > programs. I'd like to move this o

Re: Synchronous watches

2009-02-28 Thread Rich Hickey
On Feb 28, 12:47 am, Mark Derricutt wrote: > Apologies for thread-hijackig but I thought I'd mention that one of the > problems I've had using Clojure under OSGi was fixed with a minor patch > (mentioned in my post > athttp://www.talios.com/clojure_running_successfully_under_osgi.htm) which >

Re: Synchronous watches

2009-02-27 Thread Mark Derricutt
Apologies for thread-hijackig but I thought I'd mention that one of the problems I've had using Clojure under OSGi was fixed with a minor patch (mentioned in my post at http://www.talios.com/clojure_running_successfully_under_osgi.htm ) which had to do with the assumption non jar:// classpath entri

Re: Synchronous watches

2009-02-27 Thread Rich Hickey
On Feb 27, 2009, at 7:29 PM, Mark Addleman wrote: > > On Feb 27, 7:17 am, Rich Hickey wrote: >> >>> Are namespaces & global set of namespaces "watchable" things ? >> >> No they are not. > > Is there a deep reason for this? I'm not familiar with this part of > Clojure but, if the functionality

Re: Synchronous watches

2009-02-27 Thread Mark Addleman
On Feb 27, 7:17 am, Rich Hickey wrote: > > > Are namespaces & global set of namespaces "watchable" things ? > > No they are not. Is there a deep reason for this? I'm not familiar with this part of Clojure but, if the functionality is possible, would you accept a patch for this? --~--~-~

Re: Synchronous watches

2009-02-27 Thread Anand Patil
Never mind, I get it now. Thanks, Anand On Feb 27, 4:32 pm, Anand Patil wrote: > Hi Rich, > > On Feb 27, 2:57 pm, Rich Hickey wrote: > > > I've added (back) synchronous watches (svn 1309+), which used to exist > > for agents, now for all reference

Re: Synchronous watches

2009-02-27 Thread Anand Patil
Hi Rich, On Feb 27, 2:57 pm, Rich Hickey wrote: > I've added (back) synchronous watches (svn 1309+), which used to exist > for agents, now for all reference types. > > (defn add-watch > >   "Experimental. > >   Adds a watch function to an agent/atom/var/ref ref

Re: Synchronous watches

2009-02-27 Thread Rich Hickey
On Feb 27, 10:13 am, Laurent PETIT wrote: > Rich, > > I know I could search through clojure source code for this question (and > that this question is not totally related to the current thread), but could > you please tell me if there is a possibility to watch for additions/removals > of vars t

Re: Synchronous watches

2009-02-27 Thread Laurent PETIT
, multiple ns created per file, ns decomposed in multiple files ...). And I guess having the above mentioned facility would help for this. Are namespaces & global set of namespaces "watchable" things ? Thanks in advance, -- Laurent 2009/2/27 Rich Hickey > > I've ad

Synchronous watches

2009-02-27 Thread Rich Hickey
I've added (back) synchronous watches (svn 1309+), which used to exist for agents, now for all reference types. (defn add-watch "Experimental. Adds a watch function to an agent/atom/var/ref reference. The watch fn must be a fn of 4 args: a key, the reference, its old-state,