Object handles are useful as global identifiers of objects but do not present you with a transparent view of the referenced objects. Methods must be written with an explicit understanding that certain variables and arguments are remote objects and do not implicitly respond to normal protocols. Remote references, on the other hand, transparently forward all received messages to the remote objects indicated by their embedded object handle. You can use exactly the same message sends they would use if you were programming only with local objects.
Since remote references are transparent, the issue of object identity is raised. To maintain the view that remote references are just like local objects each remote object is uniquely represented locally by one and only one remote reference object. This correspondence is maintained by the space's import set. Once an object handle has been imported and a corresponding remote reference created, subsequent imports of the same remote object are replaced with the same local remote reference object--identity is maintained and operations such as == behave as expected.
Since remote references are designed to forward all messages, there is little API required. Class methods for SstRemoteReference provided as API are:
The following instance API methods are also provided:
Despite their transparency, there are a few places remote references cannot be used. The most significant being as arguments to primitives which either directly access instance variables or the class slot of their arguments. Since remote references are only representations of the actual remote object, they will not have the format (slots and so on) expected by the primitive and the results could well be catastrophic.
Do not change the shape of a remote reference while instances of that remote reference exist in the system!
Remote references (and other instances of subclasses of nil) should never be put directly in the Smalltalk dictionary or in class or pool variables. While this may appear to work while your distributed system is up and running, various parts of the normal Smalltalk infrastructure scans these objects (Smalltalk compiled methods) and sends them messages such as isClass which are not appropriate for general implementation on remote references.