[chuck-users] shreds, namespace, functions, classes, etc

Kassen signal.automatique at gmail.com
Wed Dec 12 18:19:53 EST 2007


On 19/11/2007, Ge Wang <ge at ccrma.stanford.edu> wrote:
>
> This is bug, where the internal ID is uninitialized for user instantiated
> Shred instances.  This has been fixed in CVS (unsporked shreds id default
> to 0).



 One more thing, perhaps you already implemented this but in this code;
----------------------------

Shred foo;

spork ~ test() @=> foo;

second => now;

<<<foo.id()>>>;

foo.exit();

second => now;

<<<foo.id()>>>;


fun void test()
    {
    while(1) second => now;
    }
----------------------------

I'd like the second call for foo.id to return 0. This is useful if test() is
a function that performs a specific task, then exits and we'd like to know
if it already did so. IMHO (but perhaps others have better suggestions) this
would be cleaner then defining a extra variable for this (especially as we
may not know how many we need) and if 0 is the id for non-existant shreds
this would also save making a .ifExists() (or similar) call.

Perhaps there are unforeseen downsides to this?


Keep on sporking,
Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20071213/b96e1f7b/attachment.htm 


More information about the chuck-users mailing list