T M
role Metamodel::RolePunning
Error ReportCollection examples

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␤»