leonoel / missionary

A functional effect and streaming system for Clojure/Script
Eclipse Public License 2.0
620 stars 25 forks source link

Hello task example prints only Hello with Clojure repl #91

Closed PEZ closed 10 months ago

PEZ commented 10 months ago

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 10 months ago

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.

dustingetz commented 10 months ago

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

dustingetz commented 10 months ago

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 10 months ago

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

Sorry for the noise, @leonoel !