Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make roles inheritalizable; implement inheritalize (which just return…
…s the pun), so class Foo is SomeRole { } works again.
  • Loading branch information
jnthn committed Sep 9, 2011
1 parent 1ff410a commit 9a0650a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Perl6/Metamodel/CurriedRoleHOW.pm
Expand Up @@ -23,7 +23,7 @@ class Perl6::Metamodel::CurriedRoleHOW
has @!pos_args;
has %!named_args;

my $archetypes := Perl6::Metamodel::Archetypes.new( :nominal(1), :composable(1), :parametric(1) );
my $archetypes := Perl6::Metamodel::Archetypes.new( :nominal(1), :composable(1), :inheritalizable(1), :parametric(1) );
method archetypes() {
$archetypes
}
Expand Down
2 changes: 1 addition & 1 deletion src/Perl6/Metamodel/ParametricRoleHOW.pm
Expand Up @@ -16,7 +16,7 @@ class Perl6::Metamodel::ParametricRoleHOW
has $!composed;
has $!body_block;

my $archetypes := Perl6::Metamodel::Archetypes.new( :nominal(1), :composable(1), :parametric(1) );
my $archetypes := Perl6::Metamodel::Archetypes.new( :nominal(1), :composable(1), :inheritalizable(1), :parametric(1) );
method archetypes() {
$archetypes
}
Expand Down
10 changes: 10 additions & 0 deletions src/Perl6/Metamodel/RolePunning.pm
Expand Up @@ -25,6 +25,16 @@ role Perl6::Metamodel::RolePunning {
$pun
}

# Produces something that can be inherited from (the pun).
method inheritalize($obj) {
if $!made_pun {
$!pun
}
else {
$!pun := self.make_pun($obj);
}
}

# Do a pun-based dispatch. If we pun, return a thunk that will delegate.
method find_method($obj, $name) {
if pir::exists(%exceptions, $name) {
Expand Down

0 comments on commit 9a0650a

Please sign in to comment.