Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Dev

Moose Port: Class::C3 vs Moose Method Modifiers

 

 

Catalyst dev RSS feed   Index | Next | Previous | View Threaded


groditi at gmail

May 20, 2008, 9:19 AM

Post #1 of 6 (681 views)
Permalink
Moose Port: Class::C3 vs Moose Method Modifiers

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)

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev[at]lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev


jjn1056 at yahoo

May 21, 2008, 7:26 AM

Post #2 of 6 (652 views)
Permalink
Re: Moose Port: Class::C3 vs Moose Method Modifiers [In reply to]

--- 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




_______________________________________________
Catalyst-dev mailing list
Catalyst-dev[at]lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev


marcus at nordaaker

May 25, 2008, 1:44 AM

Post #3 of 6 (631 views)
Permalink
Re: Moose Port: Class::C3 vs Moose Method Modifiers [In reply to]

>
> --- On Tue, 5/20/08, Guillermo Roditi <groditi[at]gmail.com> wrote:
>> 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.
>>
> 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.

I would like us to use method modifiers as well. This is one of the
reasons to switch to Moose, imo.

Marcus

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev[at]lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev


jheephat at gmail

May 25, 2008, 7:37 AM

Post #4 of 6 (625 views)
Permalink
Re: Moose Port: Class::C3 vs Moose Method Modifiers [In reply to]

On Sun, May 25, 2008 at 3:44 AM, Marcus Ramberg <marcus[at]nordaaker.com>
wrote:

>
> I would like us to use method modifiers as well. This is one of the reasons
> to switch to Moose, imo.
>

+1
NEXT has always confused me. I'm at least under the impression that I grok
Moose's modifiers. :)

--
Cory 'G' Watson
http://www.onemogin.com


jon at jrock

May 26, 2008, 9:41 AM

Post #5 of 6 (614 views)
Permalink
Re: Moose Port: Class::C3 vs Moose Method Modifiers [In reply to]

* On Sun, May 25 2008, Cory Watson wrote:
> On Sun, May 25, 2008 at 3:44 AM, Marcus Ramberg <marcus[at]nordaaker.com> wrote:
>
>
> I would like us to use method modifiers as well. This is one of the reasons
> to switch to Moose, imo.
>
>
> +1
>
> NEXT has always confused me. I'm at least under the impression that I grok
> Moose's modifiers. :)

It helps if you read the NEXT source code:

my @possibilities = ...;
sub goto_next_method {
my $next_method = $possibilities[int rand @possibilities];
@_ = ($self, @args);
goto $next_method;
}

OK, maybe I made that up.

Regards,
Jonathan Rockway

--
print just => another => perl => hacker => if $,=$"

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev[at]lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev


groditi at gmail

May 27, 2008, 1:06 PM

Post #6 of 6 (601 views)
Permalink
Re: Moose Port: Class::C3 vs Moose Method Modifiers [In reply to]

>
> It helps if you read the NEXT source code:
>
> my @possibilities = ...;
> sub goto_next_method {
> my $next_method = $possibilities[int rand @possibilities];
> @_ = ($self, @args);
> goto $next_method;
> }
>
> OK, maybe I made that up.

Hey Jon,

Thanks for taking the time to (only) reply to the ONE thing that was
not relevant in this thread where I was attempting to seriously
address the core dev team regarding a very important decision that
needs to be made. It's not like I asked for input regarding a behavior
that would break back compat in a not-so-unrealistic scenario. Really,
thanks.


--
Guillermo Roditi (groditi)

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev[at]lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev

Catalyst dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.