No I/O in STM transactions?

2009-04-05 Thread Hugh Winkler
Hi all, >From http://clojure.org/refs : "I/O and other activities with side-effects should be avoided in transactions, since transactions will be retried. The io! macro can be used to prevent the use of an impure function in a transaction." Isn't it OK to do I/O in a transaction as long as doing

Re: No I/O in STM transactions?

2009-04-05 Thread Stephen C. Gilardi
On Apr 5, 2009, at 3:11 PM, Hugh Winkler wrote: From http://clojure.org/refs : "I/O and other activities with side-effects should be avoided in transactions, since transactions will be retried. The io! macro can be used to prevent the use of an impure function in a transaction." Isn't it

Re: No I/O in STM transactions?

2009-04-05 Thread Dex Wood
If you want to do I/O from a transaction, just use an agent to do the I/O. Since the agent is only sent off at commit, you don't have to worry about retries. This doesn't answer your questions about idempotent I/O, but I think it is a strategy that you can use. On Apr 5, 2:11 pm, Hugh Winkler

Re: No I/O in STM transactions?

2009-04-06 Thread Hugh Winkler
On Mon, Apr 6, 2009 at 12:58 AM, Dex Wood wrote: > > If you want to do I/O from a transaction, just use an agent to do the > I/O.  Since the agent is only sent off at commit, you don't have to > worry about retries.  This doesn't answer your questions about > idempotent I/O, but I think it is a s