This is actually not the reason (before modifiers will be run before around modifiers if they are defined in the same class, for instance).
The reason is that a subclass should not have to know implementation details about how a parent class defined its methods. When you wrap a method in a subclass, the parent class method is considered an opaque thing, it isn't introspected to see if it was defined in terms of method modifiers. This provides for better encapsulation. -doy On Tue, Sep 04, 2012 at 08:59:18AM -0700, Ben Tilly wrote: > The current behavior is expected. > > An "around" method has the option to decide not to call the method. If a > subclass had an around that decided not to call the method, it would be > highly surprising if parts of the parent method had already been run. > > On Tue, Sep 4, 2012 at 8:50 AM, Alex Hole <al...@connect-service.co.uk>wrote: > > > Hi,**** > > > > ** ** > > > > What is the expected behaviour with regards to method modifiers and sub > > classes?**** > > > > ** ** > > > > I was expecting that all “before” sub routines would be run before any > > around subs.**** > > > > ** ** > > > > In current tests, I am finding that a sub classes “around” is called > > before any parent classes “before” subs.**** > > > > ** ** > > > > ** ** > > > > For a test I have there classes Base -> Sub -> Test and 3 Roles A, B & C > > applied to Base.**** > > > > Role A provides a sub test().**** > > > > ** ** > > > > Roles B&C and Classes Base,Sub,Test provide before,around & after subs for > > the test sub. Calling test on an instance of Test gives:**** > > > > ** ** > > > > Test->before test**** > > > > Test->around test**** > > > > Sub->before test**** > > > > Sub->around test**** > > > > Base->before test**** > > > > C->before test**** > > > > B->before test**** > > > > Base->around test**** > > > > C->around test**** > > > > B->around test**** > > > > A->test**** > > > > B->after test**** > > > > C->after test**** > > > > Base->after test**** > > > > Sub->after test**** > > > > Test->after test**** > > > > ** ** > > > > For classes Test and Sub, their around sub is called before the parent > > classes befores are called.**** > > > > For roles, all “before” are called before “around” is called on the class > > where the roles are composed.**** > > > > ** ** > > > > Is this correct?**** > > > > ** ** > > > > ** ** > > > > Thanks in advance**** > > > > *Alex Hole***** > > > > *Computer Programmer***** > > > > **[image: Description: Connect Service]****** > > > > *T: 0121 766 2204***** > > > > *E: ah...@connect-service.co.uk***** > > > > *www.connect-service.co.uk***** > > > > *Connect Distribution Services Ltd. | Connect House | Small Heath > > Business Park | Talbot Way | Birmingham | B10 0HJ***** > > > > ** ** > > > > ------------------------------ > > Please consider the environment before printing this e-mail > > > > ------------------------------ > > DISCLAIMER: This email and any files transmitted with it are confidential > > and intended solely for the use of the individual or entity to whom they > > are addressed. If you have received this email in error please notify the > > system manager. Please note that any views or opinions presented in this > > email are solely those of the author and do not necessarily represent those > > of the company. Finally, the recipient should check this email and any > > attachments for the presence of viruses. The company accepts no liability > > for any damage caused by any virus transmitted by this email. > >