> When it useful to be able to deref inside a dosync without ensuring?
When you deref and alter/set the same ref, the ref is protected from
modification as well.

I couldn't think of an example of what I think you had in mind,
something that requires a transaction but is tolerant of modification
of the ref.

> 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.
I agree, and since I couldn't think of an example where the current
behavior is desirable, it seems like unnecessary mental overhead.  I
don't think having the semantics of deref change depending on whether
it's used inside a transaction is the way to go (especially since a
key part of its contract is that it will never block writers,
commuters, or other readers).  Maybe @ should expand to ensure rather
than deref inside a transaction, instead?
--~--~---------~--~----~------------~-------~--~----~
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