vvvvalvalval / scope-capture

Project your Clojure(Script) REPL into the same context as your code when it ran
MIT License
573 stars 14 forks source link

Scope-capture doesn't play nice when used in core.async's go-block #21

Closed DjebbZ closed 6 years ago

DjebbZ commented 6 years ago

Hello,

I only use letsc and defsc, and noticed that when some code is spyed inside a go block from core.async, defsc doesn't work and fails with this strange error :

(sc.api/defsc 15)
             java.lang.RuntimeException: Unable to resolve symbol: objects in this context
clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Unable to resolve symbol: objects in this context, compiling:(/tmp/boot.user5571589663493149098.clj:1:1)

letsc works fine. I suppose it's because of the big code rewriting that core.async does. I'm not sure if it's a bug. Just reporting.

DjebbZ commented 6 years ago

Hum... defsc just worked... Maybe it's unrelated to core.async... No idea where this objects symbol come from

vvvvalvalval commented 6 years ago

@DjebbZ can you investigate towards a minimal repro please? :)

DjebbZ commented 6 years ago

The utlra-minimal repository I test doesn't show any bugs, so it may be something specific to the closed-source app I'm developing. May be hard to reproduce then...

In the meantime, here's the code of the ultra-minimal repro I created :

(defn bug?
  "I don't do a whole lot ... yet."
  [& args]
  (let [ch (as/chan 1)
        easy-to-spy {:a 1 :b 2}]
    (as/put! ch 1)
    (as/go
      (sc/spy (println "In chan:" (as/<! ch))))))
vvvvalvalval commented 6 years ago

@DjebbZ All right, since we haven't established that the problem has something to do core.async, I'll close this issue so as not to mislead people. Feel free to re-open one if you make progress.