> Is there anyway to assert that code does have side effects & should
> never be called in a transaction?
>
> (dosync
>  (assert (not (in-transaction)))) -> "Assert: Can't call this code in
> a transaction"
>
> That could be useful for debug builds of IO libraries.

I don't know that there's anything provided already in Clojure, but
you could use the clojure.lang.LockingTransaction#getRunning() method
to check if there is a running transaction on the current thread.

>From there it's pretty easy to write some sort of assert expression
that can be placed into your I/O routines.

/mike.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to [email protected]
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