Re: Ordering of messages to agents

2010-07-08 Thread Meikel Brandmeyer
Hi, On Jul 8, 4:53 pm, Brian Hurt wrote: > A better API for this particular use suggested itself to me: simply allow > the state to be nil, and require the functions that are sent initialize the > state if necessary.  Code like: > > (defn my_f [ state ] >     (let [ state (or state (init-functio

Re: Ordering of messages to agents

2010-07-08 Thread Brian Hurt
A better API for this particular use suggested itself to me: simply allow the state to be nil, and require the functions that are sent initialize the state if necessary. Code like: (defn my_f [ state ] (let [ state (or state (init-function)) ] ... In this case, it doesn't matter whic

Re: Ordering of messages to agents

2010-07-08 Thread Laurent PETIT
2010/7/8 Brian Hurt > > > On Wed, Jul 7, 2010 at 5:46 PM, Ryan Waters wrote: > >> On Wed, Jul 7, 2010 at 4:32 PM, Meikel Brandmeyer wrote: >> > Hi, >> > >> > Am 07.07.2010 um 23:11 schrieb Ryan Waters: >> > >> >>> (send a init-function) >> >>> (send a f)) >> >> >

Re: Ordering of messages to agents

2010-07-08 Thread Brian Hurt
On Wed, Jul 7, 2010 at 5:46 PM, Ryan Waters wrote: > On Wed, Jul 7, 2010 at 4:32 PM, Meikel Brandmeyer wrote: > > Hi, > > > > Am 07.07.2010 um 23:11 schrieb Ryan Waters: > > > >>> (send a init-function) > >>> (send a f)) > >> > >> It's not guaranteed the init-func

Re: Ordering of messages to agents

2010-07-07 Thread Ryan Waters
On Wed, Jul 7, 2010 at 4:32 PM, Meikel Brandmeyer wrote: > Hi, > > Am 07.07.2010 um 23:11 schrieb Ryan Waters: > >>>                 (send a init-function) >>>                 (send a f)) >> >> It's not guaranteed the init-function will complete before f. > > I doubt that. Since only one action ca

Re: Ordering of messages to agents

2010-07-07 Thread Meikel Brandmeyer
Hi, Am 07.07.2010 um 23:11 schrieb Ryan Waters: >> (send a init-function) >> (send a f)) > > It's not guaranteed the init-function will complete before f. I doubt that. Since only one action can be active at a time and the ordering is preserved, init-function wi

Re: Ordering of messages to agents

2010-07-07 Thread Ryan Waters
On Wed, Jul 7, 2010 at 3:46 PM, Brian Hurt wrote: > I'm wondering if the following pattern is safe or not.  I'm in a > transaction, and I want to create an agent and then send it an initializing > message (the message function isn't transaction-safe, so I don't want to run > it in the transaction)

Re: Ordering of messages to agents

2010-07-07 Thread Brian Hurt
On Wed, Jul 7, 2010 at 5:04 PM, Meikel Brandmeyer wrote: > Hi, > > Am 07.07.2010 um 22:46 schrieb Brian Hurt: > > > I'm wondering if the following pattern is safe or not. I'm in a > transaction, and I want to create an agent and then send it an initializing > message (the message function isn't

Re: Ordering of messages to agents

2010-07-07 Thread Meikel Brandmeyer
Hi, Am 07.07.2010 um 22:46 schrieb Brian Hurt: > I'm wondering if the following pattern is safe or not. I'm in a transaction, > and I want to create an agent and then send it an initializing message (the > message function isn't transaction-safe, so I don't want to run it in the > transaction

Ordering of messages to agents

2010-07-07 Thread Brian Hurt
I'm wondering if the following pattern is safe or not. I'm in a transaction, and I want to create an agent and then send it an initializing message (the message function isn't transaction-safe, so I don't want to run it in the transaction). So I want to do something like: (def my-ref (ref nil))