cemerick / austin

The ClojureScript browser-REPL rebuilt stronger, faster, easier.
510 stars 31 forks source link

Printed output isn't returned to REPL until an expression is send for evaluation #49

Open cemerick opened 10 years ago

cemerick commented 10 years ago

e.g. if a callback is printing to *out* via println, prn, etc., that output isn't returned to the REPL until another expression is sent for evaluation. This is due to the synchronous request/response model of the communication channel…a very reasonable thing for evaluation results, but very counterproductive w.r.t. printed output.

Not sure this can be readily addressed as long as we're using the CrossPageChannel, with agents server-side to serialize responses. SSE + regular XHR (as discussed in #47 and elsewhere) would solve this, though that implies significant re-work.

tomjakubowski commented 10 years ago

Nitpicking (but perhaps helpful nitpicking): I don't think an expression needs to be sent to the browser for evaluation in order to see the printed message. For example:

cljs.user=> (js/setTimeout #(println "Hello, world"))
56
cljs.user=> ; user hits <RET>
Hello, world

cljs.user=>
cemerick commented 10 years ago

Yup, you're right. This is being caused by some kind of buffering, either in piggieback, or in Austin's "constrained order" evaluation mechanism (which I don't fully understand, was inherited from ClojureScript's stock browser-REPL backend).