On Mon, May 18, 2009 at 10:54 AM, Konrad Hinsen
<konrad.hin...@laposte.net>wrote:

>
> On May 18, 2009, at 11:21, Anand Patil wrote:
>
> > Huh, sounds like just the thing. Security is going to be especially
> > difficult in Clojure, though. For example, say I stuck the array
> > into a ref from within the monad, then carried on overwriting it. A
> > consumer who gets the array out of the ref from another thread
> > might get it while I'm still mutating it.
>
> Here is an example of how this might look, using 1D Java arrays for
> simplicity:
>
> (def an-array
>   (initalize-array Integer/TYPE 10
>     [_ (set-element 0 1)
>      x (get-element 0)
>      _ (set-element 1 (inc x)]))
>

I understand better now, thanks. That seems pretty much ideal to me.

Anand

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to