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

method publish_method_cache($obj)

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

See Also

role Metamodel::AttributeContainer

Metaobject that can hold attributes

role Metamodel::C3MRO

Metaobject that supports the C3 method resolution order

role Metamodel::Documenting

Metarole for documenting types.

role Metamodel::Finalization

Metaobject supporting object finalization

role Metamodel::MethodContainer

Metaobject that supports storing and introspecting methods

role Metamodel::Mixins

Metaobject for generating mixins

role Metamodel::MultipleInheritance

Metaobject that supports multiple inheritance

role Metamodel::Naming

Metaobject that supports named types

role Metamodel::ParametricRoleGroupHOW

Represents a group of roles with different parameterizations

role Metamodel::ParametricRoleHOW

Represents a non-instantiated, parameterized, role.

role Metamodel::PrivateMethodContainer

Metaobject that supports private methods

role Metamodel::RoleContainer

Metaobject that supports holding/containing roles

role Metamodel::RolePunning

Metaobject that supports punning of roles.

role Metamodel::Stashing

Metarole for type stashes

role Metamodel::Trusting

Metaobject that supports trust relations between types

role Metamodel::Versioning

Metaobjects that support versioning

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.