Isolate.spawnuri examples?

334 views
Skip to first unread message

Jesse

unread,
Mar 6, 2012, 1:56:08 AM3/6/12
to General Dart Discussion
Does anyone have a spawnuri example? That's a pretty exciting looking
function; I'd love to see some example code.

Jesse

unread,
Mar 7, 2012, 1:36:29 AM3/7/12
to General Dart Discussion
I think I misunderstood spawnuri. I thought that it would allow an
isolate to be spawned remotely, this doesn't seem to be the case. Any
plans to make this possible?

Eli Brandt

unread,
Mar 7, 2012, 1:54:28 PM3/7/12
to Jesse, General Dart Discussion
Hi, Jesse, our one example for spawnUri() at the moment is a unit test:
http://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/tests/isolate/src/APIv2_spawnUriBrowserTest.dart
The URI in this case is not very fancy -- it's a local reference -- but any URI that points to some code *should* work (but may not yet, it's very early).

spawnUri() creates an isolate, loads code into it, and runs that.  The physical location where this isolate is created isn't specified; currently it's local to the caller but it could be done on the remote server, with their consent.  As requested by the caller, or by the code being run, or conceivably auto-migrated for best performance.  You'd then end up with a communication port open to a persistent remote process that may take advantage of its colocation with other server code and data, or of faster hardware or better bandwidth than you've got locally

Is that the type of thing you're looking for?  If you have a use in mind I'd be interested to hear more about it, since we really haven't hashed out use cases yet.

Eli

Jesse

unread,
Mar 14, 2012, 1:20:23 AM3/14/12
to General Dart Discussion
That is exactly the use case I am imagining. I hope dart can make it
incredibly easy to expose server side code and to send objects back
and forth.

On Mar 7, 11:54 am, Eli Brandt <e...@google.com> wrote:
> Hi, Jesse, our one example for spawnUri() at the moment is a unit test:http://code.google.com/p/dart/source/browse/branches/bleeding_edge/da...
Reply all
Reply to author
Forward
0 new messages