I have a couple braches sitting around, and it would be great to get
them reviewed and (possibly) merged. They are:

topic/deprecate_alias_excludes
- This builds off the previous topic/rename_alias_excludes, but actually
  adds a warning when using the old names.

topic/immutable_subclass_warning
- This deals with an issue we ran into in #moose today - someone had
  classes like this:

  package Parent;
  use Moose;

  use Child;

  has child => (
    is  => 'ro',
    isa => 'Maybe[Child]',
  );

  __PACKAGE__->meta->make_immutable;

  and

  Package Child;
  use Moose;
  extends 'Parent';

  has parent => (
    is  => 'ro',
    isa => 'Parent',
  );

  __PACKAGE__->meta->make_immutable;

  This failed because Child was being created and immutablized partway
  through the definition of Parent, and so Child's constructor (among
  other things) was incorrect (it didn't include attribute
  initialization code for the child attribute). This branch adds a
  warning whenever someone tries to call make_immutable on a class whose
  ancestor classes are not already immutable. There are a few caveats:

  - It ignores Moose::Object, since that's never going to be immutable
    (should it be?)
  - It ignores metaclasses (by ignoring anything with
    $self->isa('Class::MOP::Object')), since metaclasses created by role
    composition aren't immutablized, but the metaclass for a class is
    immutablized whenever the class is (should this be changed?)
  - It ignores anything that doesn't have a metaclass, or whose
    metaclass isn't a Moose::Meta::Class, since immutablizing non-Moose
    classes doesn't really make sense. This fails if someone has
    explicitly done Moose::Meta::Class->initialize($class) previously,
    but I don't really see a way around that.

  I think that overall, the warning is a good thing though.

topic/strict_export_list
- I was looking through the code the other day and noticed that
  Moose::Role had "as_is => [...'make_immutable']", which was apparently
  copied directly from Moose.pm back when make_immutable was a keyword,
  but when it stopped being a keyword, nobody noticed it still sitting
  in Moose::Role (since that was a mistake to begin with). The reason
  nobody noticed this is that Moose::Exporter currently doesn't care if
  a sub exists or not before trying to export it - since the subs it
  exports are wrapped, it'll export the wrapper as the given name, which
  will then die when it tries to call the original sub (but only when
  the wrapper is actually called). This branch skips exporting
  non-existent subs, with a warning.

And, a couple branches off of the attribute_helpers branch:

topic/list_util_helpers
- Adds shuffle, reduce, uniq, and natatime from List::Util and
  List::MoreUtils as helpers for Native::Array. These are probably the
  most useful ones (and most of the other useful ones can be implemented
  in terms of these, with currying), but if there are more that would be
  useful, they could certainly be added too.

topic/sort_a_b
- The coderef for the sort attribute helpers are currently passed in the
  two arguments as $_[0] and $_[1]. There was some desire expressed for
  being able to use $a and $b instead, but there's an issue in that $a
  and $b are package scoped, and only using them once in a given package
  will give the 'Name "main::a" used only once: possible typo' warning.
  This can be silenced by doing "our ($a, $b)" beforehand, and this is
  exactly how List::Util::reduce works, but it's still annoying. Another
  option would be to pass both and allow either $a and $b or $_[0] and
  $_[1] to be used, but then it would be odd to not allow $_[0] and $_
  to be used interchangably in subrefs that only take one argument, and
  confound pointed out some cases where it would be useful to allow
  those to be assigned to different things. This patch is the one I'm
  least sure about, I mainly just wanted to see what other people's
  opinions were about it.

Thanks,
-doy

Reply via email to