Product SiteDocumentation Site

1.4. How Objects Interact

The actions defined by an object are its only interface to other objects. Actions form a kind of "wall" that encapsulates the object, and shields its internal information from outside objects. This shielding is called information hiding. Information hiding protects an object's data from corruption by outside objects, and also protects outside objects from relying on another object's private data, which can change without warning.
One object can act upon another (or cause it to act) only by calling that object's actions, namely by sending messages. Objects respond to these messages by performing an action, returning data, or both. A message to an object must specify:
  • A receiving object
  • The "message send" symbol, ~, which is called the twiddle
  • The action and, optionally in parentheses, any parameters required by the action
So the message format looks like this:
object~action(parameters)
Assume that the object is the string !iH. Sending it a message to use its REVERSE action:
"!iH"~reverse
returns the string object Hi!.