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::TypePretense Metamodel::TypePretense Metamodel::CurriedRoleHOW Metamodel::CurriedRoleHOW Metamodel::CurriedRoleHOW->Metamodel::RolePunning Metamodel::CurriedRoleHOW->Any Metamodel::CurriedRoleHOW->Metamodel::TypePretense Metamodel::Naming Metamodel::Naming Metamodel::Stashing Metamodel::Stashing Metamodel::BoolificationProtocol Metamodel::BoolificationProtocol Metamodel::ParametricRoleGroupHOW Metamodel::ParametricRoleGroupHOW Metamodel::ParametricRoleGroupHOW->Metamodel::RolePunning Metamodel::ParametricRoleGroupHOW->Any Metamodel::ParametricRoleGroupHOW->Metamodel::TypePretense Metamodel::ParametricRoleGroupHOW->Metamodel::Naming Metamodel::ParametricRoleGroupHOW->Metamodel::Stashing Metamodel::ParametricRoleGroupHOW->Metamodel::BoolificationProtocol 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::ParametricRoleHOW Metamodel::ParametricRoleHOW Metamodel::ParametricRoleHOW->Metamodel::RolePunning Metamodel::ParametricRoleHOW->Any Metamodel::ParametricRoleHOW->Metamodel::TypePretense Metamodel::ParametricRoleHOW->Metamodel::Naming Metamodel::ParametricRoleHOW->Metamodel::Stashing 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

Expand above chart

Generated from