role Metamodel::RolePunning

Metaobject that supports punning of roles.

role Perl6::Metamodel::RolePunning {}

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

Implements the ability to create objects from Roles without the intermediate need to use a class. Not intended to be used directly (will in fact error if it's used), but via punning of roles, as below. This is also Rakudo specific and not part of the spec.

role A {
    method b {
      return "punned"
    }
};
my $a = A.new;
say $a.b# OUTPUT: «punned␤» 

Type Graph

Type relations for Metamodel::RolePunning
perl6-type-graph Metamodel::RolePunning Metamodel::RolePunning Mu Mu Any Any Any->Mu Metamodel::Naming Metamodel::Naming Metamodel::Documenting Metamodel::Documenting Metamodel::Versioning Metamodel::Versioning Metamodel::MethodContainer Metamodel::MethodContainer Metamodel::PrivateMethodContainer Metamodel::PrivateMethodContainer Metamodel::MultiMethodContainer Metamodel::MultiMethodContainer Metamodel::AttributeContainer Metamodel::AttributeContainer Metamodel::RoleContainer Metamodel::RoleContainer Metamodel::MultipleInheritance Metamodel::MultipleInheritance Metamodel::Stashing Metamodel::Stashing Metamodel::TypePretense Metamodel::TypePretense Metamodel::ParametricRoleHOW Metamodel::ParametricRoleHOW Metamodel::ParametricRoleHOW->Metamodel::RolePunning Metamodel::ParametricRoleHOW->Any Metamodel::ParametricRoleHOW->Metamodel::Naming Metamodel::ParametricRoleHOW->Metamodel::Documenting Metamodel::ParametricRoleHOW->Metamodel::Versioning Metamodel::ParametricRoleHOW->Metamodel::MethodContainer Metamodel::ParametricRoleHOW->Metamodel::PrivateMethodContainer Metamodel::ParametricRoleHOW->Metamodel::MultiMethodContainer Metamodel::ParametricRoleHOW->Metamodel::AttributeContainer Metamodel::ParametricRoleHOW->Metamodel::RoleContainer Metamodel::ParametricRoleHOW->Metamodel::MultipleInheritance Metamodel::ParametricRoleHOW->Metamodel::Stashing Metamodel::ParametricRoleHOW->Metamodel::TypePretense Metamodel::CurriedRoleHOW Metamodel::CurriedRoleHOW Metamodel::CurriedRoleHOW->Metamodel::RolePunning Metamodel::CurriedRoleHOW->Any Metamodel::CurriedRoleHOW->Metamodel::TypePretense Metamodel::BoolificationProtocol Metamodel::BoolificationProtocol Metamodel::ParametricRoleGroupHOW Metamodel::ParametricRoleGroupHOW Metamodel::ParametricRoleGroupHOW->Metamodel::RolePunning Metamodel::ParametricRoleGroupHOW->Any Metamodel::ParametricRoleGroupHOW->Metamodel::Naming Metamodel::ParametricRoleGroupHOW->Metamodel::Stashing Metamodel::ParametricRoleGroupHOW->Metamodel::TypePretense Metamodel::ParametricRoleGroupHOW->Metamodel::BoolificationProtocol

Expand above chart