Fix pod spelling nit
[gitmo/Moose.git] / lib / Moose / Manual / Delta.pod
index b2fa98d..72e21ab 100644 (file)
@@ -6,176 +6,391 @@ Moose::Manual::Delta - Important Changes in Moose
 
 =head1 DESCRIPTION
 
-This attempts to document any important or noteworthy changes
-in Moose both good or bad. While this does duplicate data from
-the F<Changes> file it aims to provide more details and when 
-possible fixes or workarounds as well.
-
-This document is a good way to keep up with important changes, 
-but it can also be useful in doing things like finding the lowest
-version of Moose that supported a given feature, or as a helper 
-for people upgrading Moose versions and encountering issues. 
-So if you encounter a problem and have a solution but don't see 
-it documented here, or think I missed an important feature, then 
-please send us a patch.
+This documents any important or noteworthy changes in Moose, with a
+focus on backwards. This does duplicate data from the F<Changes> file,
+but aims to provide more details and when possible workarounds.
+
+Besides helping keep up with changes, you can also use this document
+for finding the lowest version of Moose that supported a given
+feature.  If you encounter a problem and have a solution but don't see
+it documented here, or think we missed an important feature, please
+send us a patch.
+
+=head1 0.93
+
+=over 4
+
+=item Calling $object->new() is no longer deprecated
+
+We decided to undeprecate this. Now it just works.
+
+=back
+
+=head1 0.90
+
+=over 4
+
+=item Added Native delegation for Code refs
+
+See L<Moose::Meta::Attribute::Native::Trait::Code> for details.
+
+=item Calling $object->new() is deprecated
+
+Moose has long supported this, but it's never really been documented, and we
+don't think this is a good practice. If you want to construct an object from
+an existing object, you should provide some sort of alternate constructor like
+C<< $object->clone >>.
+
+Calling C<< $object->new >> now issues a warning, and will be an error in a
+future release.
+
+=item Moose no longer warns if you call C<make_immutable> for a class with mutable ancestors
+
+While in theory this is a good thing to warn about, we found so many
+exceptions to this that doing this properly became quite problematic.
+
+=back
+
+=head1 Version 0.89_02
+
+=over 4
+
+=item New Native delegation methods from L<List::Util> and L<List::MoreUtils>
+
+In particular, we now have C<reduce>, C<shuffle>, C<uniq>, and C<natatime>.
+
+=item The Moose::Exporter with_caller feature is now deprecated
+
+Use C<with_meta> instead. The C<with_caller> option will start warning in a
+future release.
+
+=item Moose now warns if you call C<make_immutable> for a class with mutable ancestors
+
+This is dangerous because modifying a class after a subclass has been
+immutabilized will lead to incorrect results in the subclass, due to inlining,
+caching, etc. This occasionally happens accidentally, when a class loads one
+of its subclasses in the middle of its class definition, so pointing out that
+this may cause issues should be helpful. Metaclasses (classes that inherit
+from L<Class::MOP::Object>) are currently exempt from this check, since at the
+moment we aren't very consistent about which metaclasses we immutabilize.
+
+=item C<enum> and C<duck_type> now take arrayrefs for all forms
+
+Previously, calling these functions with a list would take the first element of
+the list as the type constraint name, and use the remainder as the enum values
+or method names. This makes the interface inconsistent with the anon-type forms
+of these functions (which must take an arrayref), and a free-form list where
+the first value is sometimes special is hard to validate (and harder to give
+reasonable error messages for). These functions have been changed to take
+arrayrefs in all their forms - so, C<< enum 'My::Type' => [qw(foo bar)] >> is
+now the preferred way to create an enum type constraint. The old syntax still
+works for now, but it will hopefully be deprecated and removed in a future
+release.
+
+=back
+
+=head1 Version 0.89_01
+
+L<Moose::Meta::Attribute::Native> has been moved into the Moose core from
+L<MooseX::AttributeHelpers>.  Major changes include:
+
+=over 4
+
+=item C<traits>, not C<metaclass>
+
+Method providers are only available via traits.
+
+=item C<handles>, not C<provides> or C<curries>
+
+The C<provides> syntax was like core Moose C<< handles => HASHREF >>
+syntax, but with the keys and values reversed.  This was confusing,
+and AttributeHelpers now uses C<< handles => HASHREF >> in a way that
+should be intuitive to anyone already familiar with how it is used for
+other attributes.
+
+The C<curries> functionality provided by AttributeHelpers has been
+generalized to apply to all cases of C<< handles => HASHREF >>, though
+not every piece of functionality has been ported (currying with a
+CODEREF is not supported).
+
+=item C<empty> is now C<is_empty>, and means empty, not non-empty
+
+Previously, the C<empty> method provided by Arrays and Hashes returned true if
+the attribute was B<not> empty (no elements).  Now it returns true if the
+attribute B<is> empty. It was also renamed to C<is_empty>, to reflect this.
+
+=item C<find> was renamed to C<first>, and C<first> and C<last> were removed
+
+L<List::Util> refers to the functionality that we used to provide under C<find>
+as L<first|List::Util/first>, so that will likely be more familiar (and will
+fit in better if we decide to add more List::Util functions). C<first> and
+C<last> were removed, since their functionality is easily duplicated with
+curries of C<get>.
+
+=item Helpers that take a coderef of one argument now use C<$_>
+
+Subroutines passed as the first argument to C<first>, C<map>, and C<grep> now
+receive their argument in C<$_> rather than as a parameter to the subroutine.
+Helpers that take a coderef of two or more arguments remain using the argument
+list (there are technical limitations to using C<$a> and C<$b> like C<sort>
+does).
+
+See L<Moose::Meta::Attribute::Native> for the new documentation.
+
+=back
+
+The C<alias> and C<excludes> role parameters have been renamed to C<-alias>
+and C<-excludes>. The old names still work, but new code should use the new
+names, and eventually the old ones will be deprecated and removed.
+
+=head1 Version 0.89
+
+C<< use Moose -metaclass => 'Foo' >> now does alias resolution, just like
+C<-traits> (and the C<metaclass> and C<traits> options to C<has>).
+
+Added two functions C<meta_class_alias> and C<meta_attribute_alias> to
+L<Moose::Util>, to simplify aliasing metaclasses and metatraits. This is
+a wrapper around the old
+
+  package Moose::Meta::Class::Custom::Trait::FooTrait;
+  sub register_implementation { 'My::Meta::Trait' }
+
+way of doing this.
+
+=head1 Version 0.84
+
+When an attribute generates I<no> accessors, we now warn. This is to help
+users who forget the C<is> option. If you really do not want any accessors,
+you can use C<< is => 'bare' >>. You can maintain back compat with older
+versions of Moose by using something like:
+
+    ($Moose::VERSION >= 0.84 ? is => 'bare' : ())
+
+When an accessor overwrites an existing method, we now warn. To work around
+this warning (if you really must have this behavior), you can explicitly
+remove the method before creating it as an accessor:
+
+    sub foo {}
+
+    __PACKAGE__->meta->remove_method('foo');
+
+    has foo => (
+        is => 'ro',
+    );
+
+When an unknown option is passed to C<has>, we now warn. You can silence
+the warning by fixing your code. :)
+
+The C<Role> type has been deprecated. On its own, it was useless,
+since it just checked C<< $object->can('does') >>. If you were using
+it as a parent type, just call C<role_type('Role::Name')> to create an
+appropriate type instead.
+
+=head1 Version 0.78
+
+C<use Moose::Exporter;> now imports C<strict> and C<warnings> into packages
+that use it.
+
+=head1 Version 0.77
+
+C<DEMOLISHALL> and C<DEMOLISH> now receive an argument indicating whether or
+not we are in global destruction.
+
+=head1 Version 0.76
+
+Type constraints no longer run coercions for a value that already matches the
+constraint.  This may affect some (arguably buggy) edge case coercions that
+rely on side effects in the C<via> clause.
+
+=head1 Version 0.75
+
+L<Moose::Exporter> now accepts the C<-metaclass> option for easily
+overriding the metaclass (without L<metaclass>). This works for classes
+and roles.
+
+=head1 Version 0.74
+
+Added a C<duck_type> sugar function to L<Moose::Util::TypeConstraints>
+to make integration with non-Moose classes easier. It simply checks if
+C<< $obj->can() >> a list of methods.
+
+A number of methods (mostly inherited from L<Class::MOP>) have been
+renamed with a leading underscore to indicate their internal-ness. The
+old method names will still work for a while, but will warn that the
+method has been renamed. In a few cases, the method will be removed
+entirely in the future. This may affect MooseX authors who were using
+these methods.
 
 =head1 Version 0.73
 
-Calling subtype with a name as the only argument is now an
+Calling C<subtype> with a name as the only argument now throws an
 exception. If you want an anonymous subtype do:
 
     my $subtype = subtype as 'Foo';
 
-This is related to the changes in L<Version 0.71_01>.
+This is related to the changes in version 0.71_01.
+
+The C<is_needed> method in L<Moose::Meta::Method::Destructor> is now
+only usable as a class method. Previously, it worked as a class or
+object method, with a different internal implementation for each
+version.
+
+The internals of making a class immutable changed a lot in Class::MOP
+0.78_02, and Moose's internals have changed along with it. The
+external C<< $metaclass->make_immutable >> method still works the same
+way.
 
 =head1 Version 0.72
 
-A mutable class accepted Foo->new(undef) without complaint,
-while an immutable class would blow up with an unhelpful
-error. Now, in both cases we throw a helpful error
-instead. 
+A mutable class accepted C<< Foo->new(undef) >> without complaint,
+while an immutable class would blow up with an unhelpful error. Now,
+in both cases we throw a helpful error instead.
 
-This "feature" was originally added to allow for cases such 
-as this:
+This "feature" was originally added to allow for cases such as this:
 
   my $args;
-  if (something()) {
-      $args = { ... };
+
+  if ( something() ) {
+      $args = {...};
   }
+
   return My::Class->new($args);
 
-But it has been decided that this is bad form and you should 
-do what you mean more and not have Moose clean up for you.
+But we decided this is a bad idea and a little too magical, because it
+can easily mask real errors.
 
 =head1 Version 0.71_01
 
-Calling type or subtype without the sugar helpers (as, where,
-message) is now deprecated. This means that code like this
-will no longer work:
+Calling C<type> or C<subtype> without the sugar helpers (C<as>,
+C<where>, C<message>) is now deprecated.
+
+As a side effect, this meant we ended up using Perl prototypes on
+C<as>, and code like this will no longer work:
 
   use Moose::Util::TypeConstraints;
   use Declare::Constraints::Simple -All;
-  
-  subtype 'ArrayOfInts' 
+
+  subtype 'ArrayOfInts'
       => as 'ArrayRef'
       => IsArrayRef(IsInt);
 
 Instead it must be changed to this:
 
-  subtype('ArrayOfInts' => { 
-      as => 'ArrayRef', 
-      where => IsArrayRef(IsInt) 
-      } 
+  subtype(
+      'ArrayOfInts' => {
+          as    => 'ArrayRef',
+          where => IsArrayRef(IsInt)
+      }
   );
 
-If you want to maintain backwards compat in your module then 
-you can just wrap it within a version test like so:
+If you want to maintain backwards compat with older versions of Moose,
+you must explicitly test Moose's C<VERSION>:
 
-  if ($Moose::VERSION < 0.72) {
-      subtype 'ArrayOfInts' 
+  if ( Moose->VERSION < 0.71_01 ) {
+      subtype 'ArrayOfInts'
           => as 'ArrayRef'
           => IsArrayRef(IsInt);
   }
   else {
-      subtype('ArrayOfInts' => { 
-          as => 'ArrayRef', 
-          where => IsArrayRef(IsInt) 
-          } 
+      subtype(
+          'ArrayOfInts' => {
+              as    => 'ArrayRef',
+              where => IsArrayRef(IsInt)
+          }
       );
   }
 
 =head1 Version 0.70
 
-We no longer pass the meta-attribute object as a final
-argument to triggers. This actually changed for inlined code a
-while back, but the non-inlined version and the docs were
-still out of date.
-
-Not sure how many people actually used this feature, but if 
-you did, the workaround is pretty simple. You just fetch the 
-attribute object from out of the C<$self> that is passed as 
-the first argument to trigger, like so:
-
-has 'foo' => (
-    is      => 'ro',
-    isa     => 'Any',   
-    trigger => sub {
-        my ($self, $value) = @_;
-        my $attr = $self->meta->find_attribute_by_name('foo');
-        # ...
-    }
-);
+We no longer pass the meta-attribute object as a final argument to
+triggers. This actually changed for inlined code a while back, but the
+non-inlined version and the docs were still out of date.
+
+If by some chance you actually used this feature, the workaround is
+simple. You fetch the attribute object from out of the C<$self>
+that is passed as the first argument to trigger, like so:
+
+  has 'foo' => (
+      is      => 'ro',
+      isa     => 'Any',
+      trigger => sub {
+          my ( $self, $value ) = @_;
+          my $attr = $self->meta->find_attribute_by_name('foo');
+
+          # ...
+      }
+  );
 
 =head1 Version 0.66
 
-If you created a subtype and passed a parent that Moose didn't
-know about, it simply ignored the parent. Now it automatically
-creates the parent as a class type. This may not be what you
-want, but is less broken than before.
+If you created a subtype and passed a parent that Moose didn't know
+about, it simply ignored the parent. Now it automatically creates the
+parent as a class type. This may not be what you want, but is less
+broken than before.
 
-You could declare a name with subtype such as "Foo!Bar" that
-would be allowed, but if you used it in a parameterized type
-such as "ArrayRef[Foo!Bar]" it wouldn't work. We now do some
-vetting on names created via the sugar functions, so that they
-can only contain alphanumerics, ":", and ".".
+You could declare a name with subtype such as "Foo!Bar". Moose would
+accept this allowed, but if you used it in a parameterized type such
+as "ArrayRef[Foo!Bar]" it wouldn't work. We now do some vetting on
+names created via the sugar functions, so that they can only contain
+alphanumerics, ":", and ".".
 
 =head1 Version 0.65
 
 Methods created via an attribute can now fulfill a C<requires>
-declaration for a role. Honestly I don't know why I didn't make 
-this work originally, I was just insane or something.
+declaration for a role. Honestly we don't know why Stevan didn't make
+this work originally, he was just insane or something.
 
-Stack traces from inlined code will now report its line and
-file as being in your class, as opposed to in Moose guts.
+Stack traces from inlined code will now report the line and file as
+being in your class, as opposed to in Moose guts.
 
 =head1 Version 0.62_02
 
-When a class does not provide all of a role's required
-methods, the error thrown now mentions all of the missing
-methods, as opposed to just the first one found.
+When a class does not provide all of a role's required methods, the
+error thrown now mentions all of the missing methods, as opposed to
+just the first missing method.
+
+Moose will no longer inline a constructor for your class unless it
+inherits its constructor from Moose::Object, and will warn when it
+doesn't inline. If you want to force inlining anyway, pass
+C<< replace_constructor => 1 >> to C<make_immutable>.
 
-Moose will no longer inline a constructor for your class
-unless it inherits its constructor from Moose::Object, and
-will warn when it doesn't inline. If you want to force
-inlining anyway, pass "replace_constructor => 1" to
-make_immutable.
+If you want to get rid of the warning, pass C<< inline_constructor =>
+0 >>.
 
 =head1 Version 0.62
 
-Removed the (deprecated) make_immutable keyword.
+Removed the (deprecated) C<make_immutable> keyword.
 
 Removing an attribute from a class now also removes delegation
-(handles) methods installed for that attribute. This is correct 
+(C<handles>) methods installed for that attribute. This is correct
 behavior, but if you were wrongly relying on it you might get bit.
 
 =head1 Version 0.58
 
-Roles now add methods by calling add_method, not
-alias_method. They make sure to always provide a method
-object, which will be cloned internally. This means that it is
-now possible to track the source of a method provided by a
-role, and even follow its history through intermediate roles.
-This means that methods added by a role now show up when
-looking at a class's method list/map.
-
-Parameter and Union args are now sorted, this makes Int|Str
-the same constraint as Str|Int. Incoming type constraint strings 
-also are normalized to remove all whitespace differences. This is
-all mostly just for internals and should not affect outside code.
-
-Moose::Exporter will no longer remove a subroutine that the
-exporting package re-exports. Moose re-exports the
-Carp::confess function, among others. The reasoning is that we
-cannot know whether you have also explicitly imported those
-functions for your own use, so we err on the safe side and
-always keep them.
+Roles now add methods by calling C<add_method>, not
+C<alias_method>. They make sure to always provide a method object,
+which will be cloned internally. This means that it is now possible to
+track the source of a method provided by a role, and even follow its
+history through intermediate roles.  This means that methods added by
+a role now show up when looking at a class's method list/map.
+
+Parameter and Union args are now sorted, this makes Int|Str the same
+constraint as Str|Int. Also, incoming type constraint strings are
+normalized to remove all whitespace differences. This is mostly for
+internals and should not affect outside code.
+
+L<Moose::Exporter> will no longer remove a subroutine that the
+exporting package re-exports. Moose re-exports the Carp::confess
+function, among others. The reasoning is that we cannot know whether
+you have also explicitly imported those functions for your own use, so
+we err on the safe side and always keep them.
 
 =head1 Version 0.56
 
-Moose::init_meta should now be called as a method.
+C<Moose::init_meta> should now be called as a method.
 
-New modules for extension writers, Moose::Exporter and
-Moose::Util::MetaRole.
+New modules for extension writers, L<Moose::Exporter> and
+L<Moose::Util::MetaRole>.
 
 =head1 Version 0.55_01
 
@@ -195,12 +410,12 @@ So that you can do:
 
 =head1 Version 0.51
 
-Added BUILDARGS, a new step in Moose::Object::new().
+Added C<BUILDARGS>, a new step in C<< Moose::Object->new() >>.
 
 =head1 Version 0.49
 
-Fixed how the C<is =E<gt> (ro|rw)> works with custom defined 
-reader, writer and accessor options. See the below table for 
+Fixed how the C<< is => (ro|rw) >> works with custom defined
+C<reader>, C<writer> and C<accessor> options. See the below table for
 details:
 
   is => ro, writer => _foo    # turns into (reader => foo, writer => _foo)
@@ -210,85 +425,88 @@ details:
 
 =head1 Version 0.45
 
-The C<before/around/after> method modifiers now support regexp matching 
-of method names. NOTE: this only works for classes, it is currently not 
-supported in roles, but, ... patches welcome.
+The C<before/around/after> method modifiers now support regexp
+matching of method names. NOTE: this only works for classes, it is
+currently not supported in roles, but, ... patches welcome.
 
-The C<has> keyword for roles now accepts the same array ref form that 
-Moose.pm does for classes. 
+The C<has> keyword for roles now accepts the same array ref form that
+L<Moose>.pm does for classes.
 
-A trigger on a ro-attribute is no longer an error, as it's useful to 
-trigger off of the constructor.
+A trigger on a read-only attribute is no longer an error, as it's
+useful to trigger off of the constructor.
 
-Subtypes of parameterizable types now are themselves parameterizable 
-types.
+Subtypes of parameterizable types now are parameterizable types
+themselves.
 
 =head1 Version 0.44
 
-Fixed issue where DEMOLISHALL was eating the C<$@> values, and so not 
-working correctly, it still kind of eats them, but so does vanilla perl.
+Fixed issue where C<DEMOLISHALL> was eating the value in C<$@>, and so
+not working correctly. It still kind of eats them, but so does vanilla
+perl.
 
 =head1 Version 0.41
 
-Inherited attributes may now be extended without restriction on the 
+Inherited attributes may now be extended without restriction on the
 type ('isa', 'does').
 
-The entire set of Moose::Meta::TypeConstraint::* classes got refactored in 
-this release, chances are if you were relying on their internals you might
-want to check on them.
+The entire set of Moose::Meta::TypeConstraint::* classes were
+refactored in this release. If you were relying on their internals you
+should test your code carefully.
 
 =head1 Version 0.40
 
-Documenting the use of '+name' with attributes that come from recently 
-composed roles. It makes sense, people are using it, and so why not just 
-officially support it.
+Documenting the use of '+name' with attributes that come from recently
+composed roles. It makes sense, people are using it, and so why not
+just officially support it.
 
-The C<Moose::Meta::Class::create> method which now supports roles too.
+The C<< Moose::Meta::Class->create >> method now supports roles.
 
-It is now possible to make anon-enums by passing 'enum' an ARRAY ref instead 
-of the $name => @values. 
+It is now possible to make anonymous enum types by passing C<enum> an
+array reference instead of the C<< enum $name => @values >>.
 
 =head1 Version 0.37
 
-Added the 'make_immutable' keyword as a shortcut to calling make_immutable on 
-the meta object. However, this eventually gets removed again, but this is where
-the trouble began.
+Added the C<make_immutable> keyword as a shortcut to calling
+C<make_immutable> on the meta object. This eventually got removed!
 
-Making (init_arg => undef) work in Moose. This basically means "do not accept
+Made C<< init_arg => undef >> work in Moose. This means "do not accept
 a constructor parameter for this attribute".
 
-Making type errors use the assigned message, prior to this they didn't.
+Type errors now use the provided message. Prior to this release they
+didn't.
 
 =head1 Version 0.34
 
 Moose is now a postmodern object system :)
 
-The Role system was completely refactored. It is 100% backwards compat, but the 
-internals are totaly changed. So if you relied on the internals then you might 
-want to check this one out.
+The Role system was completely refactored. It is 100% backwards
+compat, but the internals were totally changed. If you relied on the
+internals then you are advised to test carefully.
 
 Added method exclusion and aliasing for Roles in this release.
 
-Added the L<Moose::Util::TypeConstraints::OptimizedConstraints> module.
+Added the L<Moose::Util::TypeConstraints::OptimizedConstraints>
+module.
 
-Passing a list of values to an accessor (which is only expecting one value) used
-to be silently ignored, now it throws an error.
+Passing a list of values to an accessor (which is only expecting one
+value) used to be silently ignored, now it throws an error.
 
 =head1 Version 0.26
 
-Added parameterized types and so did a pretty heavy refactoring of the type 
-constraint system.
+Added parameterized types and did a pretty heavy refactoring of the
+type constraint system.
 
-Better framework extendability and better support for "making your own Moose".
+Better framework extendability and better support for "making your own
+Moose".
 
 =head1 Version 0.25 or before
 
-Honestly, you shouldn't be using versions of Moose that are this old, so many 
-bug fixes and speed improvements have been made you would be crazy to not 
-upgrade.
+Honestly, you shouldn't be using versions of Moose that are this old,
+so many bug fixes and speed improvements have been made you would be
+crazy to not upgrade.
 
-Also, I am tired of going through the Changelog so I am stoping here, if 
-anyone would like to continue this please feel free.
+Also, I am tired of going through the Changelog so I am stopping here,
+if anyone would like to continue this please feel free.
 
 =head1 AUTHOR
 
@@ -303,4 +521,4 @@ L<http://www.iinteractive.com>
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
-=cut
\ No newline at end of file
+=cut