[chuck-users] setting static data at construction (bug)
signal.automatique at gmail.com
Wed Sep 10 14:00:09 EDT 2008
> Aha - so the initialization of a static member of a class doesn't work at
> all. I see. I am a bit confused about the mixing of static variable
> declarations and constructor code in classes - I would think it would be
> more clear if the two were separated syntactically somehow. But I guess it
> will work this way also.
Yes. I do suppose this bug/feature could be a side effect of a desire to
avoid having new instances reset the values of static members... but then
again those static members don't belong to instances at all and instead
belong to the class itself.
I could also imagine that the desired functionality might be to have "3 =>
static int foo;" only run when the class is defined and not when it's
instantiated. Actually that would make sense to me. At any rate I object to
the above being functionally identical to "static int foo;" with no warning.
It's interesting to note that ChucK does try;
4.3 => static int bar;
Does give a error about being unable to resolve the ChucK operator on types
float and int.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the chuck-users