next up previous contents
Next: Message Passing Up: Writing Concurrent Programs Previous: SALSA Language Support for   Contents


Actor Creation

The actor reference is one of the main new primitive values of SALSA. There are three approaches to get an actor reference: either by actor creation statement, the getReferenceByName() function, or passed arguments from messages. This section only concentrates on actor creation and reference passing.

Writing a constructor and constructing an actor in SALSA programming is similar to object construction in Java programming. For instance, one can declare the HelloWorld actor as follows:

 
// An actor reference with type HelloWorld
HelloWorld myRef;
 
   
To create an actor instance and return a reference to myRef, one can write code as follows:
 
// Assume the constructor of HelloWorld is: 
//   public HelloWorld() {}
myRef = new HelloWorld();
 
   
In SALSA, actor references are passed by reference, while object variables by value. No shared memory is possible among actors.



Wei-Jen Wang 2006-10-14