I have the same error, but only with emacs slime repl (any clojure version).

2009/5/31 Alen Ribic <alen.ri...@gmail.com>

>
> I thought I had the latest from trunk, but I was on rev 1371. Did an
> update to latest now, rev 1382. Ran the example again and it was fine
> now.
>
> -Al
>
> On Sun, May 31, 2009 at 11:48 AM, Timothy Pratley
> <timothyprat...@gmail.com> wrote:
> >
> > Hi Alen,
> >
> > I just updated to revision 1382 and it worked fine:
> > Clojure 1.1.0-alpha-SNAPSHOT
> > user=> (def foo 10)
> > #'user/foo
> > user=> (.start (Thread. (fn [] (println foo))))
> > nil
> > 10
> >
> > It also worked on whatever I was using before that. Can you confirm
> > you are experiencing this behaviour in 1382?
> >
> >
> > On May 31, 6:59 pm, Alen Ribic <alen.ri...@gmail.com> wrote:
> >> I am currently reading the Programming Clojure book and have come
> >> across an unexpected result for an example in section titled "Managing
> >> Per-thread state with Vars".
> >>
> >> Code snippet is as follows (with expected result):
> >>
> >> user> (def foo 10)
> >> #'user/foo
> >>
> >> user=> (.start (Thread. (fn [] (println foo))))
> >> nil
> >> | 10
> >>
> >> I tried the above using the clojure trunk version and my output is
> >> that println line didn't print anything:
> >>
> >> user> (.start (Thread. (fn [] (println foo))))
> >> nil
> >>
> >> However, if I try the version of clojure that accompanies the book
> >> examples then the "println foo" in the new thread prints the expected
> >> value of 10.
> >>
> >> user=> (.start (Thread. (fn [] (println foo))))
> >> nil
> >> | 10
> >>
> >> Does this make any sense? If so, why the difference?
> >>
> >> Regards,
> >> -Alen
> >>
> >> PS. I'm new to clojure and I am absolutely loving it so far.
> >> (Especially Clojure's very neat Concurrency API.)
> > >
> >
>
> >
>


-- 
Álvaro Vilanova,
http://alvivi.com

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