0

I see this notation used throughout documentation and discussions on SWT, but I've yet to see it actually defined. The comment on Stack Overflow by MarsAtomic makes me think it is just the object that is associated with a method call, or is it more complex than this?

It seems to not be the case, but that is probably me not doing something right elsewhere in SWT ;).

Here is an example for a layout method of the Composite class:

public void layout (boolean changed) {
    checkWidget ();
    if (layout == null) return;
    layout (changed, false);
}

/**
 * If the receiver has a layout, asks the layout to <em>lay out</em>
 * (that is, set the size and location of) the receiver's children. 
 * If the changed argument is <code>true</code> the layout must not rely
 * on any information it has cached about its children. If it
 * is <code>false</code> the layout may (potentially) optimize the
 * work it is doing by assuming that none of the receiver's 
 * children has changed state since the last layout.
 ...
**/
2

Object-oriented programming can be interpreted as message passing: objects are independent actors to which we can send messages (that is, we can invoke methods on that object). E.g. here I send the panel object a layoutYourself message:

panel.layoutYourself();

Some languages make this message sending more visible by using special message send operators. E.g.:

panel <- layoutYourself;

The receiver of the message, well, is called the receiver.

In languages like C++ or Java, method calls are much more like function calls than like message sends. However, the terminology “receiver” is still fairly widespread. A more function-oriented synonym is invocant: the thing on which you invoke the method.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.