12.1.2 Slot references
A slot reference is a reference to the value of a slot of an instance. The syntax for a slot reference has two parts, separated by a period:
In the following slot reference, the function get-employee-named returns an instance, which has a slot whose getter is named employee-number:
get-employee-named("Jane").employee-number;
Note that the operand that yields the instance can itself be a slot reference, so slot references can be chained:
plant.manager.employee-number;
Every slot value in Dylan is obtained by a call to the slot's getter generic function (although the compiler can often optimize this generic function call to a direct slot access). A slot reference is just an abbreviation for a function call. With one exception, the following examples are equivalent:
plant.manager; manager(plant);
The one difference between these examples is that, in the first, plant is evaluated first, whereas in the second, manager is evaluated first.
In fact, you can use the slot-reference syntax for more than slot references. The object that is the value of the left side can be any object, and the function named by the right side can be any function that can take the object as an argument. The function named by the right side is always called with the object that is the value of the left side as its only argument. Thus, using the plant.manager syntax is just another way of calling the function named by manager with the object that is the value of plant as the only argument. The plant object does not have to have a manager slot.
In this book, we use slot-reference syntax for
A call to a getter generic function for a slot
A call to a function that takes one argument and returns one value that represents a property of an object




