Skip to content

Commit 8a35386

Browse files
committed
Adds M::CurriedRoleHow
Mainly for the sake of illustration. Text copied from @jnthn comment at the beginning of the source code. Refs #1306
1 parent ef7677f commit 8a35386

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
=begin pod
2+
3+
=TITLE role Metamodel::CurriedRoleHOW
4+
5+
=SUBTITLE Support for parametrized roles that have not been instantiated
6+
7+
class Metamodel::CurriedRoleHOW
8+
does Metamodel::Naming
9+
does Metamodel::TypePretense
10+
does Metamodel::RolePunning {}
11+
12+
Sometimes, we see references to roles that provide parameters but
13+
do not fully resolve them. For example, in:
14+
15+
=for code :preamble<role R[::Type] {}; class Type {}>
16+
class C does R[Type] { }
17+
18+
We need to represent C<R[T]>, but we cannot yet fully specialize the
19+
role because we don't have the first parameter at hand. We may also
20+
run into the issue where we have things like:
21+
22+
=for code :preamble<role R[::T] {}; class T {}; my $x>
23+
sub foo(R[T] $x) { ... }
24+
if $x ~~ R[T] { ... }
25+
26+
Where we clearly want to talk about a partial parameterization of a
27+
role and actually want to do so in a way distinct from a particular
28+
instantiation of it. This meta-object represents those "partial types"
29+
as both a way to curry on your way to a full specialization, but also
30+
as a way to do type-checking or punning.
31+
32+
I<Note>: As most of the Metamodel classes, this class is here mainly for
33+
illustration purposes and it's not intended for the final user.
34+
35+
=end pod

0 commit comments

Comments
 (0)