binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Mathias Picker
Hi all, I'm fighting with shoreleave-remote-ring running on a non default context (immutant), and me not being able to rebind shoreleave.remotes.http-rpc/*remote-uri* inside a go block. If you look at https://gist.github.com/mathiasp/6448753, you will find a code snippet in the init function w

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Mathias Picker
I allready go some help on IRC, define a function with the binding and rpc call inside it and then calling that function in my go block works. I'm now trying to test a simple code snippet Anderkent gave me to see is this is a bug, but that will have to wait till tomorrow or so... Am Donnerstag,

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Mathias Picker
I just tried this test case (from Anderkent on IRC): (def pingc (chan)) (def ^:dynamic *text* "OUPS BAD ASYNC") (binding [*text* "good boy"] (go (while true ( > Hi all, > > I'm fighting with shoreleave-remote-ring running on a non default context > (immutant), and me not being able to

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Jacek Lach
That is not what happens in lein repl: user=> (use 'clojure.core.async) nil user=> (def pingc (chan)) #'user/pingc user=> (def ^:dynamic *text* "OUPS BAD ASYNC") #'user/*text* user=> (binding [*text* "good boy"] #_=> (go (while true #_=> ( (println *text* # user=> (defn p

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Timothy Baldridge
As David said, binding preservation works with Clojure, not with ClojureScript. That being said, while I can see a use for bindings in Clojure (thread-local redef), I fail to see a use-case for binding in ClojureScript. Seems like code could/should be structured in a better way. On Thu, Sep 5, 20

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Meikel Brandmeyer (kotarak)
Hi, Am Donnerstag, 5. September 2013 16:36:37 UTC+2 schrieb Mathias Picker: > > I just tried this test case (from Anderkent on IRC): > > (def pingc (chan)) > > (def ^:dynamic *text* "OUPS BAD ASYNC") > > (binding [*text* "good boy"] > (go (while true > ( (js/alert *text* > >

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread David Nolen
The Clojure core.async captures bindings at the beginning of the go block. This could be done in ClojureScript core.async as well but it needs language support to do this correctly and efficiently. David On Thu, Sep 5, 2013 at 10:48 AM, Meikel Brandmeyer (kotarak) wrote: > Hi, > > Am Donnersta

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread David Nolen
Your example doesn't accomplish what dynamic binding does. You don't need to look much further than Clojure / ClojureScript compilers to see cases where trying to propagate information through an environment like you are with ctx is absolutely too tedious, the aspect oriented nature of binding is r

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Timothy Baldridge
I used to think the same, until I wrote the current incarnation of the go macro in core.async. A few months back I ripped out all global vars (and bindings). The go "compiler" is now functionally pure, except for a single atom on the edge that counts locals. More and more I'm convinced that dynamic

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread David Nolen
On Thu, Sep 5, 2013 at 1:23 PM, Timothy Baldridge wrote: > I used to think the same, until I wrote the current incarnation of the go > macro in core.async. A few months back I ripped out all global vars (and > bindings). The go "compiler" is now functionally pure, except for a single > atom on the

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread David Nolen
Related - does using a purer approach hurt debugging and error comprehension on the host - JVM / JavaScript? On Thu, Sep 5, 2013 at 1:28 PM, David Nolen wrote: > On Thu, Sep 5, 2013 at 1:23 PM, Timothy Baldridge wrote: > >> I used to think the same, until I wrote the current incarnation of the

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread David Nolen
I actually disagree a here as core.async brings a pretty nice concurrency model into play - I suspect there are instances where you might want to construct a series of go blocks with some shared context that you'd rather not put into every go loop. In anycase improved binding support is something

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Timothy Baldridge
That can easily be done thusly: (defn do-stuff [ctx c] (go (loop [] (let [v ( wrote: > I actually disagree a here as core.async brings a pretty nice concurrency > model into play - I suspect there are instances where you might want to > construct a series of go blocks with some sha