[chuck-users] Static bug

Stefan Blixt stefan.blixt at gmail.com
Tue Nov 24 16:47:05 EST 2009


Not necessarily a bug. Again, consistent with how Java works with classes (I
sometimes wonder if Ge got hold of the Java compiler source code cheap ;)

/Stefan

On Tue, Nov 24, 2009 at 7:51 PM, Hans Aberg <haberg at math.su.se> wrote:

> For some reason, 'chuck' does not instantiate class static constants until
> there has been an instantiation of the class itself.
>
>  Hans
>
> ---- static.ck ----
> class Test {
>  3 => static int d;
>
>  fun static void print() {
>    if (d == 0)  chout <= "Nope!\n";
>    else  chout <= "Yep.\n";
>  }
> }
>
> Test.print();
> Test test_;
> Test.print();
>
> ---- run ----
> $ chuck static.ck
> Nope!
> Yep.
> ----
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>



-- 
Release me, insect, or I will destroy the Cosmos!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20091124/0b0adc20/attachment.html>


More information about the chuck-users mailing list