Debian Codegraph @

src/test/01-Basic/133.ck

raw
1 // for this to work, need chuck-1.5.0.5 or higher
2
3 // a shared value among shreds
4 global int g_value;
5
6 // initial value
7 100 => g_value;
8
9 // code str
10 "global int g_value; g_value++;" => string code;
11
12 repeat( 3 )
13 {
14 // this shows the execution order of Machine eval within a line of code
15 // Machine.eval() code runs immediately, yielding the current shred
16 cherr <= g_value <= " "
17 <= (Machine.eval(code) ? "(eval)" : "(error)") <= " "
18 <= g_value <= " "
19 <= (Machine.eval(code) ? "(eval)" : "(error)")
20 <= IO.nl();
21 }