Austin Hastings wrote:
-----Original Message----- From: Jonathan Lang [mailto:[EMAIL PROTECTED]
role A {has Cat $.x;} role B {has Dog $.x;} class Foo {does Cat; does Dog;} my Foo $bar; $bar.x; # Is this a Cat or a Dog?
<A12> If, however, two roles try to introduce a method of the same name (for some definition of name), then the composition of the class fails, and the compilation of the program blows sky high--we sincerely hope. It's much better to catch this kind of error at compile time if you can. And in this case, you can. </A12>
Since classes are autogenerating accessors based in data members, it's doubly reasonable to assume that the same solution will apply: conflict -> death.
From one C6PAN module:
role Dog { has $.collar; ... }
From another C6PAN module:
role LawEnforcementOfficer { method arrest { ... } ... }
From a third C6PAN module:
class PoliceDog does Dog does LawEnforcementOfficer { ... }
I use PoliceDog in my production code, without a problem. I don't use the collar attribute (it's unimportant in my application).
The author of the LawEnforcementOfficer role does an upgrade that fixes an important bug but also.....
role LawEnforcementOfficer { method arrest { ... } has $.collar; # for holding most recently arrested ... }
So when my program fails to compile, who do I blame? How do I fix it quickly, preferrably without creating local branches of the C6PAN modules?
=Austin