class Metamodel::CurriedRoleHOW
    does Metamodel::Naming
    does Metamodel::TypePretense
    does Metamodel::RolePunning {}

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

Sometimes, we see references to roles that provide parameters but do not fully resolve them. For example, in:

class C does R[Type{ }

We need to represent R[T], but we cannot yet fully specialize the role because we don't have the first parameter at hand. We may also run into the issue where we have things like:

sub foo(R[T$x{ ... }
if $x ~~ R[T{ ... }

Where we clearly want to talk about a partial parameterization of a role and actually want to do so in a way distinct from a particular instantiation of it. This metaobject represents those "partial types" as both a way to curry on your way to a full specialization, but also as a way to do type-checking or punning.

This class will show up in parameterized roles. For instance:

role Zipi[::T{
    method zape { "Uses " ~ T.^name };
}
role Zipi[::T, ::Y{
    method zape { "Uses " ~ T.^name ~ " and " ~ Y.^name };
}
for Zipi[Int], Zipi[Int,Str-> $role {
    say $role.HOW;
    say $role.new().zape;
}
# OUTPUT: 
# Perl6::Metamodel::CurriedRoleHOW.new 
# Uses Int 
# Perl6::Metamodel::CurriedRoleHOW.new 
# Uses Int and Str 

Since there are several variants of Zipi, providing a parameter curries it, but it's still up to the compiler to find out the actual realization taking into account the ParametricRoleGroup, so these (partially instantiated) roles show up as Metamodel::CurriedRoleHOW as shown in the example; even if there's a single parameter an instantiated role will also be of the same type:

role Zape[::T{};
say Zape[Int].HOW#: «Perl6::Metamodel::CurriedRoleHOW.new␤»

Note: As most of the Metamodel classes, this class is here mainly for illustration purposes and it's not intended for the final user to instantiate.

Type Graph §

Type relations for Metamodel::CurriedRoleHOW
perl6-type-graph Metamodel::CurriedRoleHOW Metamodel::CurriedRoleHOW Any Any Metamodel::CurriedRoleHOW->Any Metamodel::RolePunning Metamodel::RolePunning Metamodel::CurriedRoleHOW->Metamodel::RolePunning Metamodel::TypePretense Metamodel::TypePretense Metamodel::CurriedRoleHOW->Metamodel::TypePretense Mu Mu Any->Mu

Expand above chart

Generated from