What's New in Moose 1.15

| No TrackBacks

The latest release of Moose is out, and it has some big changes for Native traits.

Native trait delegations are now turned into inline code, just like regular attributes. What this means is that Moose actually generates Perl code when your class loads and then evals it.

The upside is that this makes native trait delegations faster, potentially much faster. With previous versions of Moose, if you defined a native trait as ro or bare, then you could easily end up with a pathologically slow case for delegation.

With the latest Moose, all code is inlined to use direct slot access, which is much faster.

As a bonus, native trait attributes now act more correctly. Constraints are always checked when the value of the attribute changes, and triggers are also fired.

The downside of more code generation is that this makes the compile time a little slower (in direct proportion to how many native delegations you use).

We've also made it possible to prevent Moose from adding a meta method to your class. This is handy for classes which are inheritng from a non-Moose parent (like Rose::DB::Object) that also defines a meta method.

That's the highlights of 1.15. Some of these changes (like checking constraints properly for native traits) could break existing code. Please make sure to read Moose::Manual::Delta when you upgrade!

No TrackBacks

TrackBack URL: http://blog.moose.perl.org/mt-tb.cgi/148

About this Entry

This page contains a single entry by Dave Rolsky published on October 5, 2010 2:25 PM.

Moose Backwards Compatibility Policy and Practice was the previous entry in this blog.

Moose 1.16 - bug fixes, bug fixes, and more bug fixes is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Categories

Pages

Powered by Movable Type 4.38