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 =;
say $a.b# OUTPUT: «punned␤» 

Type Graph

Type relations for 404

Expand above chart