----- Original Message ---- > From: "Fuji, Goro" <[email protected]> > > Here is a RT ticket to Mouse: > https://rt.cpan.org/Public/Bug/Display.html?id=61312 > > Applying roles after the fact changes the flow of method modifiers. It > > seems that application order takes precedence over the actual modifier > > type. > > This issue he reported occurs not only on Mouse, but also on Moose. > Is this really a problem? We should resolve it?
In the original traits papers, it was thought that roles would only provide pure methods and not have access to state. They later realized that this was a mistake and admit that accessing state is important. However, method modifiers makes this a bit tricky as you've noted. In fact, method modifiers open up a whole can o' worms, particularly when you're applying roles at runtime. There's a simple way of dealing with this: assume that as a matter of good style, method modifiers can access state, but not alter it. Otherwise, it's as bad as diddling global variables and leads to the same sort of maintenance nightmares. Cheers, Ovid -- Buy the book - http://www.oreilly.com/catalog/perlhks/ Tech blog - http://blogs.perl.org/users/ovid/ Twitter - http://twitter.com/OvidPerl Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
