-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all, I'm new to the practice of forking, and experimenting with it (well sporking) in chuck. I'm making a call along the lines of: spork ~ sporkFun(arguments) => int value; to a function: fun int sporkFun(arguments) {returs something in here} As I'm sure most of you know quite well, value doesn't get the return value from the function called by the spork, but rather the shred ID. That makes sense just fine and I can see lots of value in that. What I'm wondering is if there's a way for the child shred to return values to the parent, or as a wider question, for them to communicate in any way. I've figured out that global variables can be accessed both by parent and child, so I guess using those as flags is one way to go. Any other ideas? I think this should all be clear, but I can post code if that would help. eagerly awaiting arrays, but not envying the work by ge and the rest to bring them to us, matt - -- Matthew Shanley little secrets records and stuff http://littlesecretsrecords.com/ E-mail: matthewshanley@littlesecretsrecords.com GnuPG Public Key ID: 0x4DA4915C -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCaFoCIrtD7k2kkVwRAiW8AJ4n132UMPJeBpbdWRrQOCMw8aximwCdHOad NvpXub41Ucpwe58txsTWIso= =gutB -----END PGP SIGNATURE-----
Hi Matt and all!
spork ~ sporkFun(arguments) => int value;
to a function:
fun int sporkFun(arguments) {returs something in here}
In chuck-1.1, there is no way to get the return value of the sporked function. We can't really return the value as part of the spork operation, since the new shred now runs concurrently with the parent shred, and may itself advance time. What is needed is a "join" operation later in the parent shred to let time advance until the child shred has finished. Only then, do we know the return value. This requires synchronous events from 1.2. For now, you are totally right in that global variables is pretty much the only way to go. Super ghetto on our part. What to expect from 1.2: spork returns reference to the new shred. The parent shred can wait/join on child shred, letting time advance, or query the status of the child shred. Still have to figure out how to cleanly get the return type, since this may differ. There will be a variety of ways for shreds to talk to each other, via events and shared variables, lookup tables, across files.
eagerly awaiting arrays, but not envying the work by ge and the rest to bring them to us,
Thanks Matt for the encouragement. We are determined to make v1.2 happen as soon as possible. I refrain from setting another "release" date. We will continue to work hard! Best, Ge!
participants (2)
-
Ge Wang
-
Matthew Shanley