role Metamodel::MROBasedMethodDispatch

Metaobject that supports resolving inherited methods

role Metamodel::MROBasedMethodDispatch { }

Warning: this role is part of the Rakudo implementation, and is not a part of the language specification.

This role implements locating methods based on the method resolution order of related (usually "super"/"parent") types.

Methods

method find_method

method find_method($obj$name$no_fallback*%adverbs)

Given a method name, it returns the method object of that name which is closest in the method resolution order (MRO). If no method can be found, it returns a VM-specific sentinel value (typically a low-level NULL value) that can be tested for with a test for definedness:

for <upper-case  uc> {
    Str.^find_method: $^meth andthen .("foo").say
        orelse "method `$meth` not found".say
}
# OUTPUT: 
# method `upper-case` not found 
# FOO

If :no_fallback is supplied, fallback methods are not considered.

method find_method_qualified

method find_method_qualified($obj$type$name)

Given a method name and a type, returns the method from that type. This is used in calls like

self.SomeParentClass::the_method();

method can

method can($obj$name)

Returns the list of methods of that name the object can do.

method publish_method_cache

Defined as:

method publish_method_cache($obj)

Walk MRO and add methods to cache, unless another method lower in the class hierarchy "shadowed" it.

Type Graph

Type relations for Metamodel::MROBasedMethodDispatch
perl6-type-graph Metamodel::MROBasedMethodDispatch Metamodel::MROBasedMethodDispatch Mu Mu Any Any Any->Mu Metamodel::Naming Metamodel::Naming Metamodel::Stashing Metamodel::Stashing Metamodel::AttributeContainer Metamodel::AttributeContainer Metamodel::MethodContainer Metamodel::MethodContainer Metamodel::MultiMethodContainer Metamodel::MultiMethodContainer Metamodel::RoleContainer Metamodel::RoleContainer Metamodel::BaseType Metamodel::BaseType Metamodel::MROBasedTypeChecking Metamodel::MROBasedTypeChecking Metamodel::BUILDPLAN Metamodel::BUILDPLAN Metamodel::BoolificationProtocol Metamodel::BoolificationProtocol Metamodel::Mixins Metamodel::Mixins Metamodel::EnumHOW Metamodel::EnumHOW Metamodel::EnumHOW->Metamodel::MROBasedMethodDispatch Metamodel::EnumHOW->Any Metamodel::EnumHOW->Metamodel::Naming Metamodel::EnumHOW->Metamodel::Stashing Metamodel::EnumHOW->Metamodel::AttributeContainer Metamodel::EnumHOW->Metamodel::MethodContainer Metamodel::EnumHOW->Metamodel::MultiMethodContainer Metamodel::EnumHOW->Metamodel::RoleContainer Metamodel::EnumHOW->Metamodel::BaseType Metamodel::EnumHOW->Metamodel::MROBasedTypeChecking Metamodel::EnumHOW->Metamodel::BUILDPLAN Metamodel::EnumHOW->Metamodel::BoolificationProtocol Metamodel::EnumHOW->Metamodel::Mixins Metamodel::Documenting Metamodel::Documenting Metamodel::Versioning Metamodel::Versioning Metamodel::MultipleInheritance Metamodel::MultipleInheritance Metamodel::C3MRO Metamodel::C3MRO Metamodel::NativeHOW Metamodel::NativeHOW Metamodel::NativeHOW->Metamodel::MROBasedMethodDispatch Metamodel::NativeHOW->Any Metamodel::NativeHOW->Metamodel::Naming Metamodel::NativeHOW->Metamodel::Stashing Metamodel::NativeHOW->Metamodel::MROBasedTypeChecking Metamodel::NativeHOW->Metamodel::Documenting Metamodel::NativeHOW->Metamodel::Versioning Metamodel::NativeHOW->Metamodel::MultipleInheritance Metamodel::NativeHOW->Metamodel::C3MRO Metamodel::Finalization Metamodel::Finalization Metamodel::PrivateMethodContainer Metamodel::PrivateMethodContainer Metamodel::DefaultParent Metamodel::DefaultParent Metamodel::Trusting Metamodel::Trusting Metamodel::ClassHOW Metamodel::ClassHOW Metamodel::ClassHOW->Metamodel::MROBasedMethodDispatch Metamodel::ClassHOW->Any Metamodel::ClassHOW->Metamodel::Naming Metamodel::ClassHOW->Metamodel::Stashing Metamodel::ClassHOW->Metamodel::AttributeContainer Metamodel::ClassHOW->Metamodel::MethodContainer Metamodel::ClassHOW->Metamodel::MultiMethodContainer Metamodel::ClassHOW->Metamodel::RoleContainer Metamodel::ClassHOW->Metamodel::MROBasedTypeChecking Metamodel::ClassHOW->Metamodel::BUILDPLAN Metamodel::ClassHOW->Metamodel::BoolificationProtocol Metamodel::ClassHOW->Metamodel::Mixins Metamodel::ClassHOW->Metamodel::Documenting Metamodel::ClassHOW->Metamodel::Versioning Metamodel::ClassHOW->Metamodel::MultipleInheritance Metamodel::ClassHOW->Metamodel::C3MRO Metamodel::ClassHOW->Metamodel::Finalization Metamodel::ClassHOW->Metamodel::PrivateMethodContainer Metamodel::ClassHOW->Metamodel::DefaultParent Metamodel::ClassHOW->Metamodel::Trusting

Expand above chart