SALSA actors use asynchronous message passing as their basic form of communication. A SALSA message handler is similar to a Java method. Message passing in SALSA is implemented by asynchronous message delivery with dynamic method invocation. The following example shows how an actor sends a message to itself. Note that it is not a Java method invocation:
handler(); // equivalent to "self <- handler();" |
// send a message println() with an argument "Hello World",
// to the actor standardOutput.
standardOutput <- println("Hello World");
|
// Wrong! It does not compile!!! // Assume 'a' is an actor reference. a <- someObject.someHandler(); |