Any::Moose is out, Moo is in!

I've previously written about Any::Moose and suggested using it instead of Mouse in order to provide interoperability in code. You get Mouse unless Moose is needed and in that case you get Moose.

However, there are a few problems, mainly having some incompatibilities between Moose and Mouse (which has been drastically reduced to have as little side-effects as possible) and the load order being tricky. My original post relates to that specifically.

We now have Moo! Moo is very small, yet maintains much compatibility by simply not getting into the whole "metaclass protocol" thing, and giving you Moose-like attributes. Moo can also inflate properly into Moose objects, giving you what Any::Moose does, but correctly.

mst has written a very compelling post explaining how Mouse was started and how Any::Moose was designed in contrast to Moo, and why you should use Moo instead of Mouse or Any::Moose.

Moo is so awesome, I've started moving many of my modules to Moo. Dancer 2 is also based on Moo.

So, "can we have a smaller faster implementation of the basic parts of Moose?" - Yes, we can, it's called Moo.

6 Comments

I agree that Moo is very interesting. I wonder if you know when Moo will inflate. For example I use my MooseX::Types::NumUnit often, which has unit coercions and a variant of MooseX::AlwaysCoerce built-in. I imagine that using this will cause Moose to be needed. What about Method::Signatures, does that cause Moo to promote to Moose?

One more question. Will a cored MOP make all of these considerations obsolete, at least for Perls of that version and beyond? Won't everyone just use Moose then (or some other thing based on the MOP)?

All that said, I'm glad people are working on this problem. Organic solutions take time and sometimes wander a bit, but they should come to result in something great eventually!

As I understand it, Moo starts inflating to Moose as soon as Moose.pm has been required.

I like "Yes, we do" better than "Yes, we can".
My stuff is going to migrate to Moo as well.

Is there a convenient way to specify many accessors at once, like you can with Object::Tiny, Class::Accessor, etc? If I have a dozen accessors and just want the simplest default accessors possible, can I do something like 'map { has } @accessor_names'? It would make transitioning from the other accessor generators so much easier than having to write a dozen separate verbose lines to accomplish the same thing.

Leave a comment

About Sawyer X

user-pic Gots to do the bloggingz