Getters and Setters

An object's slots are accessed using to functions: a getter and a setter. By default, the getter function has the same name as the slot, and the setter function appends “-setter ”. These functions may be invoked as follows:

owner(sample-vehicle);	// returns owner
owner-setter(sample-vehicle, "Faisal");
      

Dylan also provides some convenient “syntactic sugar” for these two functions. They may also be written as:

sample-vehicle.owner;		// returns owner
sample-vehicle.owner := "Faisal";