leonoel/missionary

Hello task example prints only Hello with Clojure repl

PEZ opened this issue · 4 comments

PEZ commented

When I try this:

  (def slowmo-hello-world
    (m/sp (println "Hello")
          (m/? nap)
          (println "World")
          (m/? nap)
          (println "!")))

  (let [begin (System/currentTimeMillis)]
    (m/? slowmo-hello-world)
    (println "Took: " (- (System/currentTimeMillis) begin) " ms"))

I get this:

Hello
Took:  2005  ms
=> nil

It works as expected in the ClojureScript repl.

PEZ commented

Probably goes without saying, but anyway:

  (def chatty-hello-world
    (m/join vector slowmo-hello-world slowmo-hello-world))
  
  (m/? chatty-hello-world)
Hello
Hello
=> [nil nil]

Again, the naps are taken as I expect.

The subsequent printlns are logged to the terminal, suggesting the issue is an interaction with how Calva rebinds stdout to redirect it to the REPL buffer
image

IIRC, Geoffrey (emacs user) said that cider used to have this issue and fixed it in the last year (?), the toolchain stack is complex and we are not experts in this so it's hard for me to say exactly which layer is the root cause

PEZ commented

Thanks, @dustingetz . If CIDER can do the right thing, so can Calva.

Sorry for the noise, @leonoel !