[Catalyst-dev] Moose Port: Class::C3 vs Moose Method Modifiers

John Napiorkowski jjn1056 at yahoo.com
Wed May 21 15:26:37 BST 2008


--- On Tue, 5/20/08, Guillermo Roditi <groditi at gmail.com> wrote:

> From: Guillermo Roditi <groditi at gmail.com>
> Subject: [Catalyst-dev] Moose Port: Class::C3 vs Moose Method Modifiers
> To: "Catalyst Dev List" <catalyst-dev at lists.scsys.co.uk>
> Date: Tuesday, May 20, 2008, 12:19 PM
> Because we use multiple inheritance and because we have a
> history with
> NEXT, we will be using Class::C3. This change will
> hopefully buy us
> some speed gains.
> 
> At one point, we completely removed any usage of NEXT and
> replaced it
> with method modifiers but then someone said something
> (don't know who
> or what) and so I moved back to Class::C3. mst has voiced
> his
> complaints about this and made some reference to
> Class::C3::import
> being evil but I do not understand what that means and the
> test suite
> seems to work so I take it that it's not really an
> issue. There was
> also concerns over compatibility with 5.10 but I do not
> have a 5.10
> box available so someone who uses 5.10 will need to test
> there and let
> us know if something breaks.
> 
> 
> This is your time to make your vote. Moose Method Modifiers
> are
> probably slower than Class::C3, but nobody has benchmarked
> it. I,
> personally, prefer modifiers, but there is performance
> considerations
> and unless someone rewrites before/after/around in XS those
> will not
> go away. Modifiers will not be 100% compatible because they
> are not
> designed with MI in mind. This is part of the reason I went
> back to
> Class::C3.
> 
> Now is the time to express your opinions, and explain why
> you would
> prefer something over the other. Speak up  now everybody
> because I
> will ignore your complaints later.
> 
> -- 
> Guillermo Roditi (groditi)

Personally I prefer Moose style modifiers since for me it makes everything much more clear.   When you see something like:

around 'method' ->sub {...}

You know around away what this method is doing.  You don't have to hunt around in the method body for a next:method call.  

Additionally, method modifiers offer you more fine grained control.  If you are just doing something before a method, but don't need to mess with the arguments or return value, you can use "before".  That's not even counting the ability to use augment and inner() for the cases where those make sense.

Overall it's going to give us more flexibility and have the bonus of introducing the syntax to people that may not have seen it before.  The only downside I can see is the very small learning curve and the possibility that some of the pod coverage tools might give false errors.  Also, most of the Perl syntax highlighting rules haven't caught up with some of the new Moose syntax, so I guess some people might complain about that.

--John


      



More information about the Catalyst-dev mailing list