Object Finalization: <TT CLASS="LITERAL" >$FINALIZE</TT >

Sather - A Language Tutorial
Prev | Chapter 12. Built-in classes | Next

# 12.4. Object Finalization: `$FINALIZE`

`$FINALIZE` defines the single routine `finalize`. Any class whose objects need to perform special operations before they are garbage collected should subtype from `$FINALIZE`. The `finalize` routine will be called once on such objects before the program terminates. This may happen at any time, even concurrently with other code, and no guarantee is made about the order of finalization of objects which refer to each other. Finalization will only occur once, even if new references are created to the object during finalization. Because few guarantees can be made about the environment in which finalization occurs, finalization is considered dangerous and should only be used in the rare cases that conventional coding will not suffice.

Prev | Home | Next
The `SYS` Class | Up | Basic Classes and Literal Forms