class Result{}
class TestActor : Test{
Void test(){
Actor(ActorPool())|msg|{
Result()
}.send("").get
}
}
throws
sys::IOErr: Not serializable: package::Result
qualidafialFri 6 Aug 2010
All actor messages, including results, must be serializable or const. This requirement is what allows Fantom actors to operate with no cross-thread side effects.
If possible make your Result class const instead of serializable as this is better for performance. The reason is that Fantom can just reuse const objects on any thread, whereas serializable objects have to be serialized and deserialized to ensure the actor cannot cause side effects on the original object.
AkcelistoSat 7 Aug 2010
My suggestion is to write that future result must be serializable or const in doc.
If msg is not immutable or serializable, then IOErr is thrown.
And Actors already says:
Actors communicate by sending each other messages. Messages
cannot be used to pass mutable state between actors. If a message
is [immutable]`Concurrency#immutability` then it passed by reference.
Otherwise the message must be [serializable]`Serialization` in which
case a serialized copy of the object is passed. If a message is
neither immutable or serializable, then 'IOErr' is thrown.
AkcelistoSun 8 Aug 2010
They says about msg but they says nothing about future result.
Akcelisto Fri 6 Aug 2010
throws
qualidafial Fri 6 Aug 2010
All actor messages, including results, must be serializable or
const
. This requirement is what allows Fantom actors to operate with no cross-thread side effects.If possible make your
Result
classconst
instead of serializable as this is better for performance. The reason is that Fantom can just reuse const objects on any thread, whereas serializable objects have to be serialized and deserialized to ensure the actor cannot cause side effects on the original object.Akcelisto Sat 7 Aug 2010
My suggestion is to write that future result must be serializable or const in doc.
Here: http://fantom.org/doc/docLang/Actors.html
And here:
concurrent::Future.get
brian Sat 7 Aug 2010
I am all for beefing up documents!
But Future.get already says:
And Actors already says:
Akcelisto Sun 8 Aug 2010
They says about msg but they says nothing about future result.