On Mon Nov 09 22:21:58 2015, larry wrote:
> 21:25 < TimToady> m: say Iterable === Any
> 21:25 <+camelia> rakudo-moar 2ad739: OUTPUT«Method 'iterator' must be
> implemented by Iterable because it is required by a role in any
> compose_method_table at gen/moar/m-Metamodel.nqp:2661 in
> any apply at gen/moar/m-Metamodel.nqp:2671 in any compose at
> gen/moar/m-Metamodel.nqp:2807 in…»
> 21:49 < TimToady> m: sub foo(Iterable $s) {...}; say &foo.signature
> 21:49 <+camelia> rakudo-moar 2ad739: OUTPUT«Method 'iterator' must be
> implemented by Iterable because it is required by a role in any
> compose_method_table at gen/moar/m-Metamodel.nqp:2661 in
> any apply at gen/moar/m-Metamodel.nqp:2671 in any compose at
> gen/moar/m-Metamodel.nqp:2807 in…»
> 21:50 < TimToady> that tries to call Iterable.WHICH, and that forces role
> punning, which doesn't work here
> 21:50 < TimToady> m: say Iterable.foo
> 21:50 <+camelia> rakudo-moar 2ad739: OUTPUT«Method 'iterator' must be
> implemented by Iterable because it is required by a role in any
> compose_method_table at gen/moar/m-Metamodel.nqp:2661 in
> any apply at gen/moar/m-Metamodel.nqp:2671 in any compose at
> gen/moar/m-Metamodel.nqp:2807 in…»
> 21:50 < TimToady> doesn't matter which method you call on it
Well, trying to pun the role is the correct behavior on method calls on it, in
general. We maintained a rather short list of methods that did not trigger
punning; I've just expanded it quite a bit to include things people are likely
to not want it to pun on, including .WHICH. The behavior for calling .foo is
correct: it should try to pun and fail due to the missing method.
Tests in S14-roles/stubs.t.