Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
move Associative role from Pair to Enum
also add :D type qualifiers to the infix:<cmp>(Pair, Pair) multi
  • Loading branch information
moritz committed Jun 10, 2012
1 parent 1b827c2 commit 3855ccb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/Enum.pm
@@ -1,4 +1,4 @@
my class Enum {
my class Enum does Associative {
has $.key;
has $.value;

Expand Down
4 changes: 2 additions & 2 deletions src/core/Pair.pm
@@ -1,4 +1,4 @@
my class Pair is Enum does Associative {
my class Pair is Enum {
method key() is rw { nqp::getattr(self, Enum, '$!key') }
method value() is rw { nqp::getattr(self, Enum, '$!value') }

Expand All @@ -14,6 +14,6 @@ sub infix:«=>»($key, Mu $value) {
Pair.new(:key($key), :value($value))
}

multi infix:<cmp>(Pair \$a, Pair \$b) {
multi infix:<cmp>(Pair:D \$a, Pair:D \$b) {
($a.key cmp $b.key) || ($a.value cmp $b.value)
}

0 comments on commit 3855ccb

Please sign in to comment.