txt: ## c3mro.md
  role Metamodel::C3MRO
  
  Metaobject that supports the C3 method resolution order
  
  ```raku
  role Metamodel::C3MRO { }
  ```
  
  *Warning*: this role is part of the Rakudo implementation, and is not a part of the language specification.
  
  [Metamodel](/language/mop) role for the [*C3* method resolution order (MRO)](https://en.wikipedia.org/wiki/C3_linearization). *Note*: this method, along with almost the whole metamodel, is part of the Rakudo implementation.
  
  The *method resolution order* for a type is a flat list of types including the type itself, and (recursively) all super classes. It determines in which order the types will be visited for determining which method to call with a given name, or for finding the next method in a chain with [nextsame](/language/functions#sub_nextsame), [callsame](/language/functions#sub_callsame), [nextwith](/language/functions#sub_nextwith) or [callwith](/language/functions#sub_callwith).
  
  ```raku
  class CommonAncestor { };   # implicitly inherits from Any
  class Child1 is CommonAncestor { }
  class Child2 is CommonAncestor { }
  class GrandChild2 is Child2 { }
  class Weird is Child1 is GrandChild2 { };
  
  say Weird.^mro; # OUTPUT: «(Weird) (Child1) (GrandChild2) (Child2) (CommonAncestor) (Any) (Mu)␤»
  
  ```
  
  C3 is the default resolution order for classes and grammars in Raku. Note that roles generally do not appear in the method resolution order (unless they are punned into a class, from which another type inherits), because methods are copied into classes at role application time.
  
  # [Methods](#role_Metamodel::C3MRO "go to top of document")[§](#Methods "direct link")
  
  ## [method compute\_mro](#role_Metamodel::C3MRO "go to top of document")[§](#method_compute_mro "direct link")
  
  ```raku
  method compute_mro($type)
  ```
  
  Computes the method resolution order.
  
  ## [method mro](#role_Metamodel::C3MRO "go to top of document")[§](#method_mro "direct link")
  
  ```raku
  method mro($type)
  ```
  
  Returns a list of types in the method resolution order, even those that are marked `is hidden`.
  
  ```raku
  say Int.^mro;   # OUTPUT: «((Int) (Cool) (Any) (Mu))␤»
  ```
  
  ## [method mro\_unhidden](#role_Metamodel::C3MRO "go to top of document")[§](#method_mro_unhidden "direct link")
  
  ```raku
  method mro_unhidden($type)
  ```
  
  Returns a list of types in method resolution order, excluding those that are marked with `is hidden`.
  