Dear Kas,<br><br>I fear that this has to do with buffering (whether a stream is buffered or not), and if buffered, buffer size makes a difference, too.<br><br>For example, in C/C++, if you want to see the output of a fprintf() call for sure, you have to call fflush(). I don't know if it has a ChucK equivalent, though.<br>
<br>Szilveszter aka Hillaby<br><br><div class="gmail_quote">2009/10/20 Kassen <span dir="ltr"><<a href="mailto:signal.automatique@gmail.com">signal.automatique@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Fellow ChucKists,<br><br>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;<br>
---------------------8<--------------------------<br>// 'chout' is chuck out, pronounced "shout"<br>// 'cherr' is chuck err, pronounced "Cher"<br><br>// output to console on stdout<br>
chout <= 1 <= " foo " <= 5.5 <= IO.newline();<br><br>// output to console on stderr<br>cherr <= 2 <= " bar " <= 5.5 <= IO.newline();<br><br><<<"start pause">>>;<br>
second => now;<br><<<"end pause">>>;<br><br>// output to console on stderr<br>cherr <= 3 <= " bar " <= 5.5 <= IO.newline();<br><br><br>// output to console on stdout<br>
chout <= 4 <= " foo " <= 5.5 <= IO.newline();<br>-----------------------------8<--------------------------------------<br><br>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;<br>
<br>[chuck](VM): sporking incoming shred: 1 (*<a href="http://chout.ck" target="_blank">chout.ck</a>)...<br>2 bar 5.5<br>"start pause" : (string)<br>4 foo 5.5<br>1 foo 5.5<br>"end pause" : (string)<br>
3 bar 5.5<br><br>
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 advanced? <br>
<br>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.<br><br>Yours,<br>Kas.<br>
<br>_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
<br></blockquote></div><br>