12.1.6 Assignment
The assignment binary operator, :=, also is implemented as a macro. An expression that includes this operator works in a special way.
The operand to the right of the operator is evaluated first. The result is the new value to be assigned.
The operand to the left of the operator determines the place to which the new value is assigned. This operand can have one of the following kinds of syntax:
Variable name The variable name is not evaluated. Dylan assigns the new value to the variable.
Explicit function call Dylan calls the function name-setter, where name is the name of the function in the function call. The first argument to name-setter is the new value, and the remaining arguments are the arguments to name in the original function call.
Slot reference Dylan first converts the slot reference to the corresponding function call. Dylan then calls the function name-setter just as it would have if the slot reference had been an explicit function call.
Element reference Dylan first converts the element reference to the corresponding function call, using element or aref as the name of the function, as appropriate. Dylan then calls the function element-setter or aref-setter just as it would have if the element reference had been an explicit function call.
Except for the order of evaluation and returned values, the following examples are equivalent:
*my-position*.distance := 3.0; distance(*my-position*) := 3.0; distance-setter(3.0, *my-position*);
The first two examples return 3.0; the second returns whatever distance-setter returns. Usually, this value would be 3.0. Note that, if distance is the name of a slot's getter, and if the slot is constant or has a setter with a name other than distance-setter, then the assignment operation results in an error.
Except for the order of evaluation and returned values, the following examples are equivalent:
vertices[2] := list(3.5, 4.5); element(vertices, 2) := list(3.5, 4.5); element-setter(list(3.5, 4.5), vertices, 2);




