role Metamodel::MultipleInheritance { }
Warning : this role is part of the Rakudo implementation, and is not a part of the language specification.
Classes, roles and grammars can have parent classes, that is, classes to which method lookups fall back to, and to whose type the child class conforms to.
This role implements the capability of having zero, one or more parent (or super ) classes.
In addition, it supports the notion of hidden classes, whose methods are excluded from the normal dispatching chain, so that for example nextsame
ignores it.
This can come in two flavors: methods from a class marked as is hidden
are generally excluded from dispatching chains, and class A hides B
adds B
as a parent class to A
, but hides it from the method resolution order, so that mro_unhidden skips it.
method add_parent ( $ obj , $ parent , : $ hides )
Adds $parent
as a parent type. If $hides
is set to a true value, the parent type is added as a hidden parent.
$parent
must be a fully composed typed. Otherwise an exception of type X::Inheritance::NotComposed is thrown.
method parents ( $ obj , : $ all , : $ tree )
Returns the list of parent classes. By default it stops at Cool , Any or Mu , which you can suppress by supplying the :all
adverb. With :tree
, a nested list is returned.
class D { } ;
class C1 is D { } ;
class C2 is D { } ;
class B is C1 is C2 { } ;
class A is B { } ;
say A . ^ parents ( : all ) . raku ;
say A . ^ parents ( : all , : tree ) . raku ;
Returns a list of all hidden parent classes.
Returns a true value if (and only if) the class is marked with the trait is hidden
.
Marks the type as hidden.
Type relations for Metamodel::MultipleInheritance
perl6-type-graph
Metamodel::MultipleInheritance
Metamodel::MultipleInheritance
Mu
Mu
Any
Any
Any->Mu
Metamodel::Naming
Metamodel::Naming
Metamodel::Versioning
Metamodel::Versioning
Metamodel::PrivateMethodContainer
Metamodel::PrivateMethodContainer
Metamodel::MethodContainer
Metamodel::MethodContainer
Metamodel::MultiMethodContainer
Metamodel::MultiMethodContainer
Metamodel::AttributeContainer
Metamodel::AttributeContainer
Metamodel::RoleContainer
Metamodel::RoleContainer
Metamodel::ConcreteRoleHOW
Metamodel::ConcreteRoleHOW
Metamodel::ConcreteRoleHOW->Metamodel::MultipleInheritance
Metamodel::ConcreteRoleHOW->Any
Metamodel::ConcreteRoleHOW->Metamodel::Naming
Metamodel::ConcreteRoleHOW->Metamodel::Versioning
Metamodel::ConcreteRoleHOW->Metamodel::PrivateMethodContainer
Metamodel::ConcreteRoleHOW->Metamodel::MethodContainer
Metamodel::ConcreteRoleHOW->Metamodel::MultiMethodContainer
Metamodel::ConcreteRoleHOW->Metamodel::AttributeContainer
Metamodel::ConcreteRoleHOW->Metamodel::RoleContainer
Metamodel::Documenting
Metamodel::Documenting
Metamodel::Stashing
Metamodel::Stashing
Metamodel::Finalization
Metamodel::Finalization
Metamodel::DefaultParent
Metamodel::DefaultParent
Metamodel::C3MRO
Metamodel::C3MRO
Metamodel::MROBasedMethodDispatch
Metamodel::MROBasedMethodDispatch
Metamodel::MROBasedTypeChecking
Metamodel::MROBasedTypeChecking
Metamodel::Trusting
Metamodel::Trusting
Metamodel::BUILDPLAN
Metamodel::BUILDPLAN
Metamodel::Mixins
Metamodel::Mixins
Metamodel::BoolificationProtocol
Metamodel::BoolificationProtocol
Metamodel::ClassHOW
Metamodel::ClassHOW
Metamodel::ClassHOW->Metamodel::MultipleInheritance
Metamodel::ClassHOW->Any
Metamodel::ClassHOW->Metamodel::Naming
Metamodel::ClassHOW->Metamodel::Versioning
Metamodel::ClassHOW->Metamodel::PrivateMethodContainer
Metamodel::ClassHOW->Metamodel::MethodContainer
Metamodel::ClassHOW->Metamodel::MultiMethodContainer
Metamodel::ClassHOW->Metamodel::AttributeContainer
Metamodel::ClassHOW->Metamodel::RoleContainer
Metamodel::ClassHOW->Metamodel::Documenting
Metamodel::ClassHOW->Metamodel::Stashing
Metamodel::ClassHOW->Metamodel::Finalization
Metamodel::ClassHOW->Metamodel::DefaultParent
Metamodel::ClassHOW->Metamodel::C3MRO
Metamodel::ClassHOW->Metamodel::MROBasedMethodDispatch
Metamodel::ClassHOW->Metamodel::MROBasedTypeChecking
Metamodel::ClassHOW->Metamodel::Trusting
Metamodel::ClassHOW->Metamodel::BUILDPLAN
Metamodel::ClassHOW->Metamodel::Mixins
Metamodel::ClassHOW->Metamodel::BoolificationProtocol
Metamodel::NativeHOW
Metamodel::NativeHOW
Metamodel::NativeHOW->Metamodel::MultipleInheritance
Metamodel::NativeHOW->Any
Metamodel::NativeHOW->Metamodel::Naming
Metamodel::NativeHOW->Metamodel::Versioning
Metamodel::NativeHOW->Metamodel::Documenting
Metamodel::NativeHOW->Metamodel::Stashing
Metamodel::NativeHOW->Metamodel::C3MRO
Metamodel::NativeHOW->Metamodel::MROBasedMethodDispatch
Metamodel::NativeHOW->Metamodel::MROBasedTypeChecking
Metamodel::TypePretense
Metamodel::TypePretense
Metamodel::RolePunning
Metamodel::RolePunning
Metamodel::ParametricRoleHOW
Metamodel::ParametricRoleHOW
Metamodel::ParametricRoleHOW->Metamodel::MultipleInheritance
Metamodel::ParametricRoleHOW->Any
Metamodel::ParametricRoleHOW->Metamodel::Naming
Metamodel::ParametricRoleHOW->Metamodel::Versioning
Metamodel::ParametricRoleHOW->Metamodel::PrivateMethodContainer
Metamodel::ParametricRoleHOW->Metamodel::MethodContainer
Metamodel::ParametricRoleHOW->Metamodel::MultiMethodContainer
Metamodel::ParametricRoleHOW->Metamodel::AttributeContainer
Metamodel::ParametricRoleHOW->Metamodel::RoleContainer
Metamodel::ParametricRoleHOW->Metamodel::Documenting
Metamodel::ParametricRoleHOW->Metamodel::Stashing
Metamodel::ParametricRoleHOW->Metamodel::TypePretense
Metamodel::ParametricRoleHOW->Metamodel::RolePunning
Expand above chart