On Wed, Sep 23, 2009 at 7:14 AM, Timothy Pratley
<timothyprat...@gmail.com>wrote:

> When it useful to be able to deref inside a dosync without ensuring?
>


In a read-only transaction.



> Ensure seems like a more safe default of what I'd expect from a
> transaction. So why not make deref automatically ensure within a
> dosync? It takes a bit of care to remember to use ensure instead of
> deref in a dosync.
>

You only need to ensure if you don't use alter or ref-set later.

The typical use case for ensure is:
(when (a-predicate? (ensure foo)) (alter bar f arg1 arg2))

Christophe

--~--~---------~--~----~------------~-------~--~----~
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