[chuck-users] setting static data at construction (bug)

Kassen signal.automatique at gmail.com
Thu Sep 11 09:27:59 EDT 2008

Stefan Blixt;
> Yeah, 4 => static int i; in a class should either result in a syntax error
> or in 4 being assigned to i once, either at define time or the first time
> the class is referenced. The current behaviour is wrong.

I think it should be set at define time because of the special case that
static data (in public classes) forms for ChucK. It's useful to be able to
set values in classes that are never instantiated and are only used to share
data across the VM. We can already do that by setting the value outside of
the class in the file that defines the class but I feel this is far cleaner
and less likely to lead to confusion when we have a lot of files holding a
lot of classes.

If we'd really like to only set the value at the moment the class is first
instantiated for some reason we could go;

class ZeClass
    static int has_a_instance;
    static int DaValue;

    if (!has_a_instance)
        1=> has_a_instance;
        3 => DaValue;

...I'm not sure when or why you would want that but you can.

Ge; I know and it's fine. If at all possible I would like some feedback on
when I'm simply mistaken. I think I've been "complaining" about some of the
Mini's behaviour while in truth it was already fixed and I hadn't adapted my
own behaviour to the updated feature set yet. I feel a bit bad about that
but in my defence; the doc's on that update really are quite vague and
mainly mention more intelligent behaviour, not *in what way* it's been more
intelligent for the last 4 versions...

Generally I think the bug finding process is going well now. I like the
structure of first debating it on the list or forum and then when people
agree this is a real bug adding it to the Wiki to be ticked off in a future
update. While I like to chat with you I also think it's good that we seem to
have reached a stage where there is no real need for you to personally and
timely confirm something is a bug, which is good, considdering the lack of
hours in a day. Decentralisation can be good.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080911/02f75381/attachment.html>

More information about the chuck-users mailing list