On Jan 19, 1:59 pm, "John D. Hume" <duelin.mark...@gmail.com> wrote:
> With the latest from svn, I'm seeing the following weird behavior.
>
> (def r (ref :old))
> (let [old-value @r]
>   (try
>     (dosync (ref-set r :new))
>     (finally
>       (dosync (ref-set r old-value))
>       )))
> (println "@r is" @r)
>
> This prints "@r is nil" whereas I'd expect it to print "@r is :old".
> But the following prints "@r is :old" as expected:
>
> (def r (ref :old))
> (let [old-value @r]
>   (try
>     (dosync (ref-set r :new))
>     (finally
>       old-value       ; This line is the only difference
>       (dosync (ref-set r old-value))
>       )))
> (println "@r is" @r)
>
> The only difference is the do-nothing expression old-value that
> immediately follows the finally. Am I missing something or is this a
> bug?
>
> I realize this is a very weird thing to be doing. In the real world
> you'd want to have one (dosync ...) block, but this is for a macro for
> unit tests where I want to be able to restore the proper value of a
> ref after a test has had a chance to mess it up.
>


Fixed - SVN 1217 - thanks for the report!

Rich

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