The self system variable references the current instance (method receiver), and can be used in any expression. You can use the self system variable on the left of an assignment only in an updating primitive method.
When referring to a property or method of the current instance, you do not have to reference the self system variable. For example, to access a pea property in the receiver object of a method, you do not have to write self.pea, as simply writing pea is sufficient.
However, there is sometimes a requirement to refer to self explicitly. The following is an example of a method of the
replaceCharacter(char: Character; withChar: Character) updating; vars count : Integer; begin foreach count in 1 to self.length do if self[count] = char then self[count] := withChar; endif; endforeach; end;