updating Option

The updating method option indicates that the method can modify properties in the object to which it is sent; for example:

sysNotification(eventType: Integer;
                theObject: Object;
                eventTag:  Integer) updating;
begin
    if eventType = Object_Create_Event or
        eventType = Object_Delete_Event then
            myForm.caption := "Customers " & allCustomers.size.String;
    endif;
end;

If you do not specify this method option, any instructions that update properties in the self object (that is, the object that is executing the method) or that attempt to call update methods for the self object will result in errors at compile time.

Alternatively, you can specify this method option by using the Updating check box in the Jade Method Definition or External Method Definition dialog. By default, this option is unset.

A temporary value is created if the return value of a primitive method is passed to an updating primitive method. On completion of the updating method, this temporary value is discarded. In the following example, a temporary string is used to return the value from the call to the String primitive type trimBlanks method. This value (abc) is then passed to the String primitive type replaceChar method, which updates the temporary string to zbc. The temporary string is discarded after the call to the replaceChar method, leaving the local variable str unchanged.

vars
    str : String;
begin
    str := ' abc ';
    str.trimBlanks.replaceChar('a', 'z');
    write str;
end;

Methods defined on collections with the updating method option are regarded as also having the lockReceiver option, even if it is not declared explicitly.

The updating method option cannot be combined with the typeMethod method option.