# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #64766]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=64766 >


OH HAI from NPW::2009.

In Rakudo 2c13d6c, the 'handles' instruction on attributes in roles
don't override those of the class it mixes in.

$ perl6 -e 'class A { method foo { say "OH HAI" }; method aie { say
"AIE!" } }; role B { has A $.bar handles * }; class C does B { has A
$.bar handles "foo" }; C.new.aie'
Could not locate a method 'aie' to invoke on class 'C'.
[...]

I don't think that the above case is mentioned in the spec, but by the
principle of mixins adding attributes consistent with the existing
ones, the above should dispatch to A.aie(), instead of failing.

By the same token, I guess the following should actually be an error:

$ perl6 -e 'class A { method foo { say "OH HAI" }; method aie { say
"AIE!" } }; role B { has A $.bar handles "aie" }; class C does B { has
A $.bar handles "foo" }; C.new.aie'
AIE!

Finally, if the two 'handles' RHSes were regular expressions instead
of strings, I guess all bets are off and we should fail just in case.
At least unless we can introspect regexes.

Reply via email to