Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start to tease apart abstract roles (the name for the whole set of po…
…ssible parameterizations) and concrete roles (a particular variant) in the type system, and tweak infix:<does> to take advantage of it. Probably more to come on this, but it's a start.
- Loading branch information
Showing
3 changed files
with
47 additions
and
2 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
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,41 @@ | ||
## $Id$ | ||
|
||
=head1 NAME | ||
|
||
src/classes/ConcreteRole.pir - methods for the ConcreteRole class | ||
|
||
=head1 Description | ||
|
||
A concrete role is a role that has been selected from an abstract role by | ||
providing a (possibly empty) set of role parameters. This class for now | ||
is primarily just designed to know how to match one of them in a multiple | ||
dispatch. | ||
|
||
=head1 Methods | ||
|
||
=over 4 | ||
|
||
=cut | ||
|
||
.namespace ['ConcreteRole'] | ||
|
||
.sub 'onload' :anon :init :load | ||
.local pmc p6meta, proto | ||
p6meta = get_hll_global ['Mu'], '$!P6META' | ||
proto = p6meta.'new_class'('ConcreteRole', 'parent'=>'Any') | ||
.end | ||
|
||
.sub 'PROTOOVERRIDES' :method | ||
.return ('new', 'ACCEPTS') | ||
.end | ||
|
||
.sub 'ACCEPTS' :method | ||
.param pmc topic | ||
$I0 = isa topic, 'P6role' | ||
$P0 = '&prefix:<?>'($I0) | ||
.return ($P0) | ||
.end | ||
|
||
=back | ||
|
||
=cut |
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