7.2 Accessing instance variables (slots)

The method `object<->slot' is used to access slots directly, bypassing possible methods with the same name. Normally, it should only be used in ->initialise (see below) and when defining a method with the same name as a variable. Below is a fragment where a type slot is displayed by a text object named type in a graphical object. This variable has access get, associating a universal method <-type that yields the current value of the slot. The implementation of ->type uses the ->slot method to write the argument in the <-type slot and subsequently performs the required side-effects. The ... indicate where the fragment is incomplete.

variable(type,  name,   get, "Epistemological type").

initialise(D, Type:name, ...) :->
        send_super(D, initialise),
        send(D, slot, type, Type),
        send(D, display, new(T, text(Type))),
        send(T, name, type),

type(D, Type:type) :->
        "Modify the epistemological type"::
        send(D, slot, type, Type),
        get(D, member, type, Text),
        send(Text, string, Type).
object ->slot: name, unchecked
object <-slot: name
uncheckedRead or write slot without side-effects. The value will be converted to the type of the instance variable addressed. An error is raised if this conversion is not defined or if the slot does not exist.