Why did this change happen?The dart:isolate library was the last "dart:" library that needed a big overhaul.We decided to keep the core primitives (spawning, sending and receiving) simple. In future iterations we intend introduce important functionality to the Isolate class.When will the change take effect?The change was committed moments ago.--
Give a man a fire and he's warm for the whole day,
but set fire to him and he's warm for the rest of his life. - Terry Pratchett
--
For general Dart discussion, consider posting to mi...@dartlang.org
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Project Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eng+uns...@dartlang.org.
For more options, visit https://groups.google.com/a/dartlang.org/groups/opt_out.
--
For general Dart discussion, consider posting to mi...@dartlang.org
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Project Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eng+uns...@dartlang.org.
For more options, visit https://groups.google.com/a/dartlang.org/groups/opt_out.
Hi Florian,I see in the documentation that Isolate.spawn functions returns an "Isolate" instance that can be used to control the isolate, but I don't see any control functions, just a SendPort for the isolate. Am I missing something? What do you do if an isolate hangs? How do you get rid of it?
--
For general Dart discussion, consider posting to mi...@dartlang.org
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Project Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eng+uns...@dartlang.org.
For more options, visit https://groups.google.com/a/dartlang.org/groups/opt_out.
main() {
var monkey = new MyMonkey();
monkey.start('foo').then((result) {
// do something with the result
});
}
class MyMonkey extends Monkey {
run(message) {
// return something
}
}
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
I'm having a hard time with the isolates samples, too. It'd be nice if we could provide some abstraction—if not in the API, then in the samples.
On Fri, Nov 1, 2013 at 10:50 AM, Florian Loitsch <floi...@google.com> wrote:
On Fri, Nov 1, 2013 at 5:51 PM, Kathy Walrath <kat...@google.com> wrote:
I'm having a hard time with the isolates samples, too. It'd be nice if we could provide some abstraction—if not in the API, then in the samples.When you say "isolates samples" which samples do you mean?
import 'dart:isolate';
main () {
Isolate.spawn(Foo.foo, null);
}
class Foo {
static foo(msg){}
}
http://api.dartlang.org/docs/releases/latest/dart_isolate/Isolate.htmlStates: "The argument entryPoint specifies the entry point of the spawned isolate. It must be a static top-level function or a static method that takes no arguments."However, static methods do not work.
import 'dart:isolate';
main () {
Isolate.spawn(Foo.foo, null);
}
class Foo {
static foo(msg){}
}Bombs with:Unhandled exception:
Illegal argument(s): Isolate.spawn expects to be passed a top-level function
Anyhow, even if that would work, it wouldn't help with adding some kind of abstraction. You can't override some static method and have that static method be called by some static method of the base class.I'm either overlooking something (please tell me if I do), or the currently available puzzle pieces just aren't enough to create any kind of abstraction. There doesn't seem to be any way to hide all of that plumbing.
[By the way, the documentation of spawnUri mentions 4 signatures, but only lists 3.]
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
high(numberOfFingers) => 'High $numberOfFingers!';
main () {
Isolate.spawnWorker(high).send(5).then((result) {
print(result);
});
}
On Nov 2, 2013 8:57 PM, "Florian Loitsch" <floi...@google.com> wrote:
>
> I guess this would be possible if we could send static/global functions. We will look into that (no promises).
The inability to wrap the isolate APIs has been a problem from the beginning. Back when I was working on isolate related things I ran into this and talked with Gilad about adding an isStatic or isTopLevel getter to ClosureMirror and making closurization preserve this information.
This way the behavior of only allowing top-level functions wouldn't be an extra-lingual feature.
Justin
> To unsubscribe from this group and stop receiving emails from it, send an email to announce+u...@dartlang.org.
I guess this would be possible if we could send static/global functions. We will look into that (no promises).
To unsubscribe from this group and stop receiving emails from it, send an email to announce+u...@dartlang.org.
On Sun, Nov 3, 2013 at 4:57 AM, Florian Loitsch <floi...@google.com> wrote:
I guess this would be possible if we could send static/global functions. We will look into that (no promises).That would definitely open up some scenarios that aren't possible now, where we can only "send" one function, the one that gets called initially.It would make a kind of sense if the things that could be sent were also the things that could be compile-time constants. We already have num, String, bool, null, Lists and Maps. Adding static/top-level functions would fit in fine.
That just leaves normal const objects, or objects of a class with a const constructor. Would be kind of cool, but not nearly as simple.
-eng and announceOn Sun, Nov 3, 2013 at 12:46 PM, Lasse R.H. Nielsen <l...@google.com> wrote:
On Sun, Nov 3, 2013 at 4:57 AM, Florian Loitsch <floi...@google.com> wrote:
I guess this would be possible if we could send static/global functions. We will look into that (no promises).That would definitely open up some scenarios that aren't possible now, where we can only "send" one function, the one that gets called initially.It would make a kind of sense if the things that could be sent were also the things that could be compile-time constants. We already have num, String, bool, null, Lists and Maps. Adding static/top-level functions would fit in fine.That would be awesome. Right now we're left with trying to look up something by name with ClosureMirror.findInContext().That just leaves normal const objects, or objects of a class with a const constructor. Would be kind of cool, but not nearly as simple.The difficulty here is in ensuring that you have the class defined, and with a compatible definition, in the other isolate. If you can check that, or guarantee it like with spawnFunction, then const should work. It'd be nice if there were a shared heap for such objects so that no copies were needed.
import 'dart:async';
import 'dart:isolate';
// boilerplate wrapper
void wrapFiverize(SendPort agency) {
var receiver = new ReceivePort();
agency.send(receiver.sendPort);
receiver.first.then((portAndValue) {
portAndValue[0].send(fiverize(portAndValue[1]));
});
}
// boilerplate runner
Future runFiverize(value) {
var spawnPort = new ReceivePort();
return Isolate.spawn(wrapFiverize, spawnPort.sendPort)
.then((_) => spawnPort.first).then((SendPort agent) {
var receiver = new ReceivePort();
agent.send([receiver.sendPort, value]);
return receiver.first;
});
}
int fiverize(int n) => n * 5;
main() {
runFiverize(7).then((res) {
print(res);
});
}