Re: Possible Issue with Listing 11.5 from the "Joy of Clojure"

2011-07-30 Thread Ken Wesson
On Sat, Jul 30, 2011 at 12:10 AM, Julien Chastang wrote: > By the way, I still think you need a lock in the count function in the > case where the caller tries to invoke the count function on a > partially constructed object. I don't think that's possible in this case. As far as code running on t

Re: Possible Issue with Listing 11.5 from the "Joy of Clojure"

2011-07-30 Thread pmbauer
"Please post all Errors and Corrections here" http://www.manning-sandbox.com/thread.jspa?threadID=41321&tstart=0 On Friday, July 29, 2011 9:10:00 PM UTC-7, Julien Chastang wrote: > > Thanks for your in-depth analysis. > > In conclusion, the 11.5 listing is broken specifically with the > reificat

Re: Possible Issue with Listing 11.5 from the "Joy of Clojure"

2011-07-30 Thread Julien Chastang
Thanks for your in-depth analysis. In conclusion, the 11.5 listing is broken specifically with the reification of the seq function. The problem is that the seq function allows the array reference to escape in an unsafe manner. The issue is concurrency as well as visibility. As you suggest, the onl

Re: Possible Issue with Listing 11.5 from the "Joy of Clojure"

2011-07-29 Thread Ken Wesson
On Fri, Jul 29, 2011 at 3:19 PM, Julien wrote: > This listing is an attempt to make the function safe for concurrent > modification. My claim is that count and seq should also be locking > around "a" for exactly same reason as aget and aset. In particular, > locking is not only ensuring mutual exc