--- Revision 343838643963 +++ Revision 303561633331 @@ -1,4 +1,4 @@ -20:49 ~/g/code/p6/t$ cat Tree/LLRB.pm6 +21:09 ~/g/code/p6/t$ cat Tree/LLRB.pm6 class Tree::LLRB { class Node { has $.key is rw; @@ -8,10 +8,7 @@ has $.color is rw; method new($key, $val) { - $.key = $key; - $.val = $val; - # True == Red, False == Black - $.color = True; + nextwith(self, :$key, :$val, :color) } method colorFlip() { @@ -89,10 +86,9 @@ } } } -20:49 ~/g/code/p6/t$ perl6 -e 'use Tree::LLRB; Tree::LLRB.new().insert(1, True).dump()' -Type objects are abstract and have no attributes, but you tried to access $!key - in 'Node::new' at line 10:Tree/LLRB.pm6 - in 'Tree::LLRB::insert_at_node' at line 56:Tree/LLRB.pm6 - in 'Tree::LLRB::insert' at line 50:Tree/LLRB.pm6 +21:09 ~/g/code/p6/t$ perl6 -e 'use Tree::LLRB; Tree::LLRB.new().insert(1, True).dump()' +too many positional arguments: 2 passed, 1 expected + in 'Node::new' at line 1 + in 'Tree::LLRB::insert_at_node' at line 53:Tree/LLRB.pm6 + in 'Tree::LLRB::insert' at line 47:Tree/LLRB.pm6 in main program body at line 1 -