Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
First, though basically working, implementation of does and but opera…
…tors. Undertested so far - there will be bugs.
  • Loading branch information
jnthn committed Jul 10, 2011
1 parent 6503f6b commit 5349d59
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/core/operators.pm
Expand Up @@ -7,6 +7,24 @@ sub infix:<=>(Mu \$a, Mu \$b) is rw {
pir::perl6_container_store__0PP($a, $b)
}

proto infix:<does>(|$) { * }
multi infix:<does>(Mu \$obj, Mu:U \$role) is rw {
# XXX Mutability check.
$obj.HOW.mixin($obj, $role);
}
multi infix:<does>(Mu \$obj, @roles) is rw {
# XXX Mutability check.
$obj.HOW.mixin($obj, |@roles);
}

proto infix:<but>(|$) { * }
multi infix:<but>(Mu \$obj, Mu:U \$role) {
$obj.HOW.mixin($obj.clone(), $role);
}
multi infix:<but>(Mu \$obj, @roles) {
$obj.HOW.mixin($obj.clone(), |@roles);
}

sub SEQUENCE($left, $right, :$exclude_end) {
my @right := $right.flat;
my $endpoint = @right.shift;
Expand Down

0 comments on commit 5349d59

Please sign in to comment.