clara-rules icon indicating copy to clipboard operation
clara-rules copied to clipboard

Explanations can print out of order due to println

Open devn opened this issue 10 years ago • 2 comments

See: http://yellerapp.com/posts/2014-12-11-14-race-condition-in-clojure-println.html

clojure.core/println will sometimes print things out of order. Could these calls to println in clara.tools.inspect be replaced with calls to a safe println like the one shown in the above link?

devn avatar Oct 12 '15 20:10 devn

Are you seeing items printed out of order, or items interleaved with other output printed from other threads? I think the above link would explain interleaving, but if we see things printed out of order we might have another bug.

If the problem is interleaving with other threads, I'd be fine with having the explain functions print to a buffer, and having that buffer flush atomically to some arbitrary output. That would fix the interleaving and also make it easier for users to, say, write explanations to external files or other output.

rbrush avatar Oct 13 '15 02:10 rbrush

@rbrush items interleaved with output printed from other threads. I'll submit a PR to write to a buffer. Writing explanations to external files was basically what drove me to open this issue.

devn avatar Oct 14 '15 19:10 devn