I'm pretty fuzzy on how nREPL works, so I might be getting it wrong here 
... but I think it processes each method through a `future`. See:

https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/server.clj#L28

All of the nREPL operations are async, AFAIK, and I think the future is 
also relied upon to implement interruptible evaluation. See:

https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/middleware/interruptible_eval.clj#L243

But I can't say I really understand that much of the eval code, so like I 
say, I could be totally wrong here!


Jony


On Tuesday, 9 February 2016 18:19:09 UTC, Nathan Marz wrote:
>
> I was doing some work that involved the use of thread locals, and I 
> noticed that within a REPL session (launched via 'lein repl') my thread 
> locals would reset themselves to their initial value. I did some digging 
> and found that the thread id keeps changing within a single REPL session, 
> e.g.:
>
> user=> (.getId (Thread/currentThread))
> 65
> user=> (.getId (Thread/currentThread))
> 74
> user=> (.getId (Thread/currentThread))
> 78
> user=> (.getId (Thread/currentThread))
> 78
> user=> (.getId (Thread/currentThread))
> 78
> user=> (.getId (Thread/currentThread))
> 82
>
> I'm hoping someone who knows the internals of the REPL could shed some 
> light onto why this is the behavior and why it was designed this way.
>
> Thanks,
> Nathan
>
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to