fREWdiculous!
15 Nov
Moo was just released! As mst says, Moo is almost, but not quite, two thirds of Moose. Or maybe Minimalistic Object Orientation. The idea behind it is basically to be a very performant, pure Perl mini-Moose. It supports lots of Moose features already and even more are on the way. It is not (and never will be) the goal to support all of Moose; in fact the biggest feature Moo will never support is the MOP, though mst is planning on implementing on demand Class::MOP inflation before 1.0.
I’m already working on a module which leverages Moo and it’s pretty neat! Sadly I’ve not had a lot of opportunities to use Moose at work, and on CPAN unless I’m working on something big (like DBIx::Class::DeploymentHandler) I try to avoid it for compile time speed reasons. So now I get to use builder and handles and method modifiers and roles and all that other cool Moose stuff that I like.
The really interesting thing about Moo is that if you read some of the (non Moo namespaced) modules in the package you’ll find that at it’s core Moo is really just a handy code generation library. Don’t believe me? Run the test suite with the environment variable SUB_QUOTE_DEBUG set and read the handy generated constructors and accessors!
I am hoping to actually go through the codebase for Moo and do something with it. I don’t want to promise anything yet, but I have some fun ideas that I may start as early as this week, so stay tuned!
8 Responses for "Moo: woohoo!"
SO I’ll ask the obvious, why Moo and not Mouse?
and there’s a module that allows you to use method modifiers without using moose… or mouse…
From a quick glance, Moo seems to be a bit more lightweight than Mouse, and it’s pure Perl. But, from the Moo POD: “Unlike Mouse this module does not aim at full Moose compatibility.”
I for one welcome more competition on the scene. Startup performance-wise, Moose really really sucks. It doesn’t deserve total domination
@xeno: steven for the most part hit the nail on the head. Oh and if you look you’ll notice that Moo uses Class::Method::Modifiers for that.
Another thing to note is that with Moo you don’t pay for any of the features that you don’t use. So if you never use method modifiers CMM never even gets loaded.
So, this is basically like Class::Struct, but using the Moose idioms?
@Jay: no, it’s really a lot more powerful than that. The most fundamental difference is that with Moo and friends you have roles, which is a solution to the problems introduced by multiple inheritance. Additionally there are a LOT of other niceties that help reduce code and bring clarity by using shared names for things instead of idioms. See builders and handles for examples of that.
@fREW so which is faster to startup? and run Moo or Mouse? will Moo be added to Any::Moose?
@xeno: There is an actual benchmark included in the dist, which if you are curious you should check out. There are a number of variables to consider, most importantly XS, since mouse uses XS extensively if possible.
Also, the plan is not to add Moo to Any::Moose, but instead to build Any::Moose into Moo, such that if a person loads up Moose, Moo will inflate all of it’s objects into Moose objects.
Leave a reply