Joe Gottman wrote:
> Luke Palmer wrote:
> > Your renaming can be done easily enough, and more clearly (IMO) with:
> >
> >   class Trog
> >     does Dog does Tree {
> >       method bark() { ... }   # Explicitly remove the provided method
> >       method dogBark()  { .Dog::bark() }
> >       method treeBark() { .Tree::bark() }
> >   }
> 
>    But won't explicitly removing bark() from the class also disable
> Dog::bark() and Tree::bark() for the class?  

No.  method bark isn't technically being removed; rather, method
Trog::bark is being defined as "postpone the definition" while
simultaneously taking precedence over both Dog::bark and Tree::bark, since
it is a class method native to Trog while the others are role methods
provided to Trog - and class methods take precedence over role methods. 
So if "my Trog $spot; $spot.bark;" is executed, perl will unambiguously
call $spot.Trog::bark, and then complain that it hasn't been defined. 
(This assumes that it doesn't complain during compile-time.)

This works, but seems counterintuitive to me.  

=====
Jonathan "Dataweaver" Lang

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

Reply via email to