I just started looking at this today, I think it looks very cool.
Can't say I completely understand the code yet because I just read
through it rather quickly.
But I have a question about the alter-cell function in the last
version posted by Stuart:
The last two lines of alter-cell are sends to the same agent (the cell
being operated on). In the first, a function that is to be run on
update is stored in the state of the cell ((send c# assoc :fn (fn []
~expr))) and in the second the cell is told to update itself.
Does this not mean that if several alter-cell statements execute in
parallell on the same cell then it is possible that some of the
functions set in the first send are discarded?
It could get ordered something like this in the queue of functions to
run on the agent:
(assoc ...)
(assoc ...) <-- "destroys" the :fn set by the first assoc
(update...)
(update...)
If this was not intended, a way to fix it is to make the update-cell
into a single call, perhaps taking the update function as an argument
rather than reading it from the cell state.

But like I said I've not completely understood the code so please
don't be mean to me if this was a retarded thing to point out :)

/mac

On 23 Sep, 04:55, "Stuart Sierra" <[EMAIL PROTECTED]> wrote:
> Ok, here's another version of Cells, attached.  This one uses Agents,
> like MikeM wrote.  It works even on a 10000-link chain of dependencies
> -- see examples in the comment at the end.  Cells get updated
> asynchronously via actions on Agents.  I may be missing some (dosync
> ...) wrappers in there.
>
> I discovered, however, that asynchronous updates may not be what you
> want!  For example, my Swing demo doesn't work correctly now -- the
> red square leaves behind a trail of visual artifacts, probably because
> the repaint triggers are getting called in random order from multiple
> threads.  So maybe Refs were better, or maybe I'm using Agents
> incorrectly.
>
> -Stuart
>
>  acells.clj
> 7KVisaHämta
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to