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