2010/6/12 Dan Larkin <d...@danlarkin.org>

> Does anyone have insight as to the reasoning here? Is it a bug? If it's
> intended behavior is there something I can do to circumvent it?
>

I do think this is intentional.

Agents "holding on" to their sends until its state transition function is
done can be a useful thing. Either the function completes and the actions
get sent, or (maybe due to an exception being thrown) the function fails,
the agent doesn't change its state and the pending sends are dropped. This
results in a everything-or-nothing update model for agents, somewhat similar
to transactions (which are also "holding on" to sends, btw).

If this wasn't the default behaviour, I think it would be very tedious to
write code that needs it.

One solution to the sleep problem could perhaps be to let the agent send
this to it self:

(fn [state millis]
  (Thread/sleep millis)
  state)

// raek

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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