austin icon indicating copy to clipboard operation
austin copied to clipboard

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

Open cemerick opened this issue 10 years ago • 2 comments

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.

cemerick avatar Feb 14 '14 21:02 cemerick

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=>

tomjakubowski avatar Feb 28 '14 04:02 tomjakubowski

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).

cemerick avatar Feb 28 '14 15:02 cemerick