gorilla-repl icon indicating copy to clipboard operation
gorilla-repl copied to clipboard

Not all println calls show output

Open lspector opened this issue 9 years ago • 3 comments

A simple call to println produces two output fields, one for the printed output and one for the return value. That's great. A call to doseq with a body that includes call to println seems to work fine too, as in (doseq [x (range 10)] (println x)).

However, this shows only the return value, with the printed stuff not being shown anywhere:

(repeatedly 20 #(do (println 1) 2))

lspector avatar Dec 25 '15 23:12 lspector

Isn't that the expected behaviour? I would have guessed that repeatedly would generate an unrealised lazy seq, so none of the print functions will get called unless something realises the seq.

JonyEpsilon avatar Feb 24 '16 17:02 JonyEpsilon

It's strange, because the sequence is realized, as we know because we see (2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2) in the field for the return value. We wouldn't see that if it was an unrealized lazy sequence. I assume it is being realized by the REPL.

However, I've now tried (doall (repeatedly 20 #(do (println 1) 2))) and this does show the additional field with the results of the println calls. This seems really odd to me.

lspector avatar Feb 24 '16 17:02 lspector

Huh, good point. That is very weird.

Looking in the debugger, I don't see any out messages coming back from the nREPL server, so I suspect the bug might be on that side of things (fine example of passing the buck there!)

But what's weird is that it does print the values, even without the doall in the command line REPL. And this, like Gorilla, is supposed to be just a client for the nREPL server, so the behaviour should be the same.

Will have to ponder on this some more ...

JonyEpsilon avatar Feb 24 '16 17:02 JonyEpsilon