On 11/21/05, Dan Horne <[EMAIL PROTECTED]> wrote:
> The reply pointing to Class::C3 looks interesting - I'd never heard of that
> module before. However, it seems that there is still a problem coming up
> with a satisfactory solution - if a developer is using a number of plugins,
> and there are one or more method collisions, it's going to be hard for said
> developer to resolve which one should take precedence. IMO - none should -
> it should just error - or at least raise a warning. If there is a warning,
> then maybe there could be a mechanism for the developer to programmatically
> specify a preference.

In my response to Michael, I mentioned that Class::Trait has a
mechanism for you to resolve these conflicts between Trait modules
manually, by specifically excluding certain methods from the import. 
Here is the doc example again:

use Class::Trait
       'TComparable' => {
           # exclude the basic equality method
           # from TComparable and use the ones
           # in TEquality instead.
           exclude => [ "notEqualTo", "equalTo" ]
       },
       'TEquality' # <- use equalTo and notEqualTo from here
);

So you just use the 'exclude' option with one of the Traits.

> If there is a collision from multiple inheritance rather than mixins, then
> maybe the Class::C3 approach might be worth investigating...

Traits can't have collisions with methods that are not in the caller's
class, since Class::Traits doesn't look at the inheritance tree at
all.  So if a method exists in your SUPER class, and you use a Trait
module that provides the same method name, then the Trait method will
still be installed sucessfully into the caller class, and it will
override whatever is in the inheritance tree.

So the only colission issues with Traits are when the method already
exists in the caller class, or if you load two or more Traits that
provide the same method name.

Cheers,

Cees

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to