[chuck-users] Return values of sporked functions?

Kassen signal.automatique at gmail.com
Fri Jun 6 02:34:53 EDT 2008


2008/6/6 mike clemow <gelfmuse at gmail.com>:

> Hello list,
>

Hey, mike!

>
> Couldn't find this one in the manual.  Where do sporked funcitons
> return to?  How do I get the return value of a spoked function?
>

they don't and you won't, I fear..... (or shred-heaven, depending on your
persuasion)

Normal functions run inside of a shred and can return a value for the rest
of the shred to work with. Sporked functions, on the other hand, run paralel
to the sporking shred, in their own shred. As the originating shred doesn't
wait for them to finish it makes no sense for them to return anything.
Because of this you can only spork functions of return-type "void".

You can still, BTW, advance time within a normal function if you'd like. On
the other hand; you don't need to advance time in sporked functions as such,
it's just that sporking only makes sense if you also advance time in that
function/shred.

Because of this I'm not really sure what you need return values from sporked
functions for but if your sporked functions need to comunicate to the other
shreds on what they've done events may suit your needs?

Hope that clarifies.
Yours,
Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080606/c07c3cc5/attachment.html>


More information about the chuck-users mailing list