On Mon, 07 Aug 2017 08:25:10 -0700, c...@zoffix.com wrote: > On Thu, 29 Jun 2017 03:46:02 -0700, c...@zoffix.com wrote: > > Mu provides iterator method, but when you mix in a role that wants it > > implemented, it doesn't find it: > > > > m: role Meow { method iterator {…} }; class Bar does Meow {} > > camelia rakudo-moar 2a8d1e: OUTPUT: «5===SORRY!5=== Error while > > compiling <tmp>â¤Method 'iterator' must be implemented by Bar > > because > > it is required by roles: Meow.â¤at <tmp>:1â¤Â» > > > > Yet it all works fine if you are also doing `is SomethingUnrelated`: > > > > m: class Foo { method x {} }; role Meow { method iterator {…} }; > > class > > Bar is Foo does Meow {} > > camelia rakudo-moar 2a8d1e: ( no output ) > > > Another example turned up; fails to notice the method is provided by > `handles`: > > class HTTP::Header does Associative does Iterable { > subset StrOrArrayOfStr where Str | ( Array & {.all ~~ Str} ); > > has %!fields of StrOrArrayOfStr > handles <AT-KEY EXISTS-KEY DELETE-KEY push > iterator list kv keys values>; > > method Str { #`[not shown, for brevity] } > } > > This is from https://github.com/perl6/doc/issues/1438
Rakudo PR request 1170 submitted to address this. With that patch applied both above examples work and this still fails, as it should: $ perl6 -e 'class Foo { method x {} }; role Meow { method elems {…} }; class Bar is Mu does Meow {}' ===SORRY!=== Error while compiling -e Method 'elems' must be implemented by Bar because it is required by roles: Meow. at -e:1