//Number 32 //Chuck a day 2009 //by Scott Hewitt //www.ablelemon.co.uk/chuckaday //Each section should be added to the ChucK VM in turn //Section 1 //Extend Event Class public class E extends Event{ int value; } //Section 2 //Create VM wide extended event public class F{ static E @ value; } new E @=> F.value; //Section 3 //Send extended events with ints function void s (){ while (true){ Std.rand2(100,300) => F.value.value; F.value.broadcast(); 500::ms => now; <<<"sent">>>; } } //spork ~ r(); spork ~ s(); while (true){ 1::day => now; } //Section 4 //print recieved event int values while (true){ F.value => now; <<>>; <<<"got">>>; }