<component>.kill
procedure
A function to destroy the external object to which component points. A zero value is returned when successful. One is returned on error.
It is usually possible only to destroy objects created, and therefore owned, by the session, e.g. by the oleobj and oleload functions. In contrast, objects created externally by third-party systems may be referenced by the system via component identifiers but usually cannot be destroyed. Such externally created objects are usually returned via member variables and member functions of other objects.
The .kill function applied to an object owned by the session will destroy the object.
The .kill function applied to other external objects will remove all trace of it within the session, but may not actually destroy the object itself.
An object housed in a component window (via the wcomponent command) cannot be destroyed by this method. Only when the window is deleted does the component get destroyed, via an internal .kill.
After external object removal, all component identifiers referencing it are nullified.
The code of the function cannot be redefined.
When queries to object member variables or functions yield pointers to other external objects, the resulting objects remain known to the system only as long as:
the parent object exists.
there are no references to such child objects.
a .kill is executed on the child object(s).
Consider an external object A which has a member variable comp which returns a component. Then the command tell A.comp might print obj87004e, but then the command A.kill would destroy all record of obj87004e. However, recording a reference to A.comp in a component identifier before destruction of A, would retain a record of the object's existence, e.g.
tell A.comp ;# might print obj87004e component myca = A.comp A.kill tell myca ;# would still print obj87004e
To destroy any record of obj87004e, the command myca.kill would then be required.