[chuck-users] chout and cherr confuse me [BUG?]

Kassen signal.automatique at gmail.com
Tue Oct 20 15:01:04 EDT 2009

Fellow ChucKists,

Consider this edit of one of the new examples, I just made this because I
was trying to figure out the difference between chout and cherr and why the
plain example's output had the order in which the results of the operations
were printed reversed;
// 'chout' is chuck out, pronounced "shout"
// 'cherr' is chuck err, pronounced "Cher"

// output to console on stdout
chout <= 1 <= " foo " <= 5.5 <= IO.newline();

// output to console on stderr
cherr <= 2 <= " bar " <= 5.5 <= IO.newline();

<<<"start pause">>>;
second => now;
<<<"end pause">>>;

// output to console on stderr
cherr <= 3 <= " bar " <= 5.5 <= IO.newline();

// output to console on stdout
chout <= 4 <= " foo " <= 5.5 <= IO.newline();

Now, the output this gives varies with how many times we used the various
commands in the recent past and on what, but it stabilises to this after
running it a few times;

[chuck](VM): sporking incoming shred: 1 (*chout.ck)...
2 bar 5.5
"start pause" : (string)
4 foo 5.5
1 foo 5.5
"end pause" : (string)
3 bar 5.5

It seems to me that chout has some sort of internal buffer and that it takes
two chout commands to reach the actual console, instead of one, like I
expected. It also seems like cherr has a higher priority of some sort. maybe
cherr commands print immediately while chout ones are delayed until time is

I'd like to know what the intended behaviour is as I'm now just guessing
about the difference between the two. Right now I'm leaning towards
suspecting at least a bug in chout.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20091020/31cf323a/attachment.html>

More information about the chuck-users mailing list