[chuck-users] sporking member function and static
Atte André Jensen
atte.jensen at gmail.com
Mon Jun 19 19:26:14 EDT 2006
Hi
I played a bit with my problem of sporking a member function and found
that the attached example (static_member.ck) actually *do* work.
However (as the comment in the code suggest) if the function sporkee()
is *not* declared as a static function, I get:
[chuck](VM): NullPointerException: shred[id=2:spork~exp], PC=[3]
Could soneone provide a meaningfull explanation, why that is? And is the
exception (when "static" is removed) to be considered a bug in chuck?
Finally, what *exactly* does "static" mean? The documentation states
that static data and functions "are shared by all instances of that
class". Ok, I understand that. But apparently "static" doesn't mean
"cannot be changed" (which is what the word implies), mostly applicable
to data, as the other example (static.ck) shows. So, why was the word
"static" chosen, shouldn't it have been "global" or "shared" or
something like that? Or is there a historical/traditional reason behind
the word "static" that I'm not aware of? Whatever the reason, I think
this (that "static" doesn't mean "unchangeable" and when + why it's
neccessary to declare things, esp. functions "static", like in the case
of "spork_member.ck") needs mention in the manual, since I might not be
the only one thrown off by this...
Thanks in advance for any response.
--
peace, love & harmony
Atte
http://www.atte.dk | quartet: http://www.anagrammer.dk
http://www.atte.dk/gps | compositions: http://www.atte.dk/compositions
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: spork_member.ck
Url: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20060620/6553eb3f/attachment.bat
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: static.ck
Url: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20060620/6553eb3f/attachment-0001.bat
More information about the chuck-users
mailing list