Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Adds M::CurriedRoleHow
Mainly for the sake of illustration. Text copied from @jnthn comment at the beginning of the source code. Refs #1306
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| =begin pod | ||
| =TITLE role Metamodel::CurriedRoleHOW | ||
| =SUBTITLE Support for parametrized roles that have not been instantiated | ||
| class Metamodel::CurriedRoleHOW | ||
| does Metamodel::Naming | ||
| does Metamodel::TypePretense | ||
| does Metamodel::RolePunning {} | ||
| Sometimes, we see references to roles that provide parameters but | ||
| do not fully resolve them. For example, in: | ||
| =for code :preamble<role R[::Type] {}; class Type {}> | ||
| class C does R[Type] { } | ||
| We need to represent C<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: | ||
| =for code :preamble<role R[::T] {}; class T {}; my $x> | ||
| 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 meta-object 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. | ||
| I<Note>: As most of the Metamodel classes, this class is here mainly for | ||
| illustration purposes and it's not intended for the final user. | ||
| =end pod |