[chuck-users] [chuck] chuck- released (also miniAudicle)

Ge Wang gewang at CS.Princeton.EDU
Thu Jul 20 10:32:54 EDT 2006


>> static timeEvent @ quarter;
>> new timeEvent @=> quarter;
> That seems to work, thanks.

To further clarify, the declaration of the static timeEvent @ quarter
is inside the class, but the initialization new timeEvent @=> quarter
should be outside in this case.  Otherwise, quarter gets reinitialized
every time the class is instantiated - or quarter never gets initialized
if the class is never instantiated.

So the code should probably be something like:


public class timeEvent extends Event { /* etc */ }

public class Time
     // declare as reference (@)
     static timeEvent @ quarter;

     fun static void send() {
          while(true) {
              /* code */

// initialize outside (temporary workaround)
new timeEvent @=> Time.quarter;


Same with any static objects, including arrays.  The new error message:

: cannot declare static non-primitive objects (yet)...
: ...(hint: declare as ref (@) & initialize outside for now)

is just there temporarily to point out the static declaration doesn't 
work until static members are fully fixed.  we reckon it's probably 
to err out rather than allow misleading code due to compiler bugs, yeah?

Best wishes,

More information about the chuck-users mailing list