txt: ## finalization.md
  role Metamodel::Finalization
  
  Metaobject supporting object finalization
  
  ```raku
  role Metamodel::Finalization { ... }
  ```
  
  *Warning*: this role is part of the Rakudo implementation, and is not a part of the language specification.
  
  This role takes care that `DESTROY` submethods are called (if they exist) when an object is garbage-collected.
  
  # [Methods](#role_Metamodel::Finalization "go to top of document")[§](#Methods "direct link")
  
  ## [method setup\_finalization](#role_Metamodel::Finalization "go to top of document")[§](#method_setup_finalization "direct link")
  
  ```raku
  method setup_finalization($obj)
  ```
  
  Collects the `DESTROY` submethods from this class and all its superclasses, and marks the class as needing action on garbage collection.
  
  A metamodel for a kind that implements finalization semantics must call this method at type composition time.
  
  ## [method destroyers](#role_Metamodel::Finalization "go to top of document")[§](#method_destroyers "direct link")
  
  ```raku
  method destroyers($obj --> List:D)
  ```
  
  Returns a list of all finalization methods.
  