[chuck-users] I don't get the hint (more static stuff)
gewang at CS.Princeton.EDU
Mon Sep 11 16:24:43 EDT 2006
> I wanted to have a static array of strings within a public class. This
> turns out not to be allowed yet but there is hope; instead of a plain
> error I got a hint;
> "cannot declare static non-primitive ojects (yet) (hint; declare as
> ref (@) and initialise outside for now)"
Oh no. You've stumbled upon the disaster within a disaster.
The bigger disaster, of course, is that static variables don't work
properly yet (you have to initialize Objects outside the class). The
nested disaster within that is because strings are treated as
primitives in parts of the type-checker, and as objects in others.
This is a priority bug but is dependent on garbage collection. Yikes.
So, for now, no static strings. You would need a wrapper to achieve
the same effect.
public class X
static StupidHack @ our_hack;
new StupidHack @=> X.our_hack;
"hello" @=> X.our_hack.m_str;
Very very sorry about this... Doh.
More information about the chuck-users