On Sun Jul 24 07:11:16 2011, masak wrote:
> <masak> rakudo: role R { method foo { self.bar(42) }; method bar($x) {
> say "OH HAI" } }; class C does R { method foo { self.R::foo } };
> C.new.foo
> <p6eval> rakudo 922500: OUTPUT«OH HAI␤»
> <masak> rakudo: role R { method bar($x) {}; method foo { self.bar(42)
> } }; class C does R { method foo { self.R::foo } }; C.new.foo
> <p6eval> rakudo 922500: OUTPUT«Not enough positional parameters
> passed; got 1 but expected 2␤ in 'bar' at line 22:/tmp/N060_2D3In␤  in
> 'C::foo' at line 22:/tmp/N060_2D3In␤  in main program body at line
> 22:/tmp/N060_2D3In␤»
> * masak submits rakudobug
> <masak> only the order of the method declarations in the role differs.
> <masak> rakudo: role R { method bar($x) { say "OH HAI" }; method foo {
> self.bar(42) } }; R.new.foo
> <p6eval> rakudo 922500: OUTPUT«OH HAI␤»
> <masak> and it seems that, somehow, the role method delegation is
> necessary to trigger it.

The second variant no longer errors. If you put a say $x in the bar method, 
it's printed out.

Closable?

-- 
Will "Coke" Coleda

Reply via email to