Examples of slots


balance is an assignable data slot.
deposit: an withdraw: are method slots.

The icon in the button tells you the kind of slot.
This is a constant slot:

Clicking on a method's button opens a test editor.

Clicking on a data slot's button summons the object referred to by the slot.

Examples of slots

The figure shows a bank account object. It has three slots, named balance, deposit: and withdraw:. Balance is an assignable slot which currently contains 100, whereas deposit: and withdraw: contain methods. Deposit: takes its argument and adds it to the balance. Withdraw: subtracts its argument from the balance, but ensures that the balance does not go below zero.

In the graphical representation of the object, we can distinguish method slots from data slots, and constant slots from assignable slots, by the icon in the button at the right hand of the slot.

  • The icon on a method slot is meant to suggest a text editor. Clicking it with the left mouse button opens an editor on the source of the method.

  • The icon on a constant slot is an equality symbol, suggesting invariance.

  • The icon on an assignable data slot is a colon, to remind you that the assignment message is the slot name suffixed with a colon.

  • Left-clicking on the button on a data slot summons the object referenced from that slot.

If you want to dismiss an object from the screen, use the `Dismiss' entry on the right-button (blue menu).

To the left of each button appears a piece of text (in italics) which describes what's in the slot. Sometimes there is insufficient room for a complete description; then, an ellipsis (...) will appear. Left-clicking the button always tells you the whole story by opening a method editor or summoning the object.

You can hide or expose the slots in an object by clicking on the triangle at the top left of the object; this cause the view to collapse if it was expanded or expand if it was collapsed.

[ Previous ] [ Index ] [ Next ]