Fork me on GitHub
#core-async
<
2015-08-18
>
darwin11:08:28

does core.async and binding play well in clojurescript? it looks like using binding inside go block, doesn't restore previous bindings for me: https://github.com/darwin/plastic/blob/23be567d74030b45ccd98aee6846a848eb81c05a/cljs/src/worker/plastic/worker/frame.cljs#L51-L53

meow12:08:09

@darwin: the issue there is go - just keep in mind that go is a macro that does crazy stuff in order to work. Because of that, you only want code inside a go/go-loop block that absolutely has to be there. I'm not surprised that something like binding doesn't work properly inside a go block.

meow12:08:50

I'm not claiming to understand exactly what go does, I just know that it rewrites your code dramatically and keeping go block as simple as possible avoids a lot of pain.

darwin12:08:24

@meow: I’m also not surprised, what worries me is that all re-frame handlers are running inside go loop, which is pretty large code surface, I will have to think twice when using binding from now on

darwin12:08:45

wait, I will do another test, with binding inside function call, not immediately in go body

meow12:08:01

right - give that a try

meow12:08:23

the go macro has no depth - it isn't going to rewrite the content of some called function

meow12:08:45

so it should not matter what code you have in those called functions - hence re-frame is safe because all it is doing is dispatching to handlers

darwin12:08:52

confirmed, in function called directly from go body it works as expected

darwin12:08:34

I feel much safer now simple_smile