From: Yuval Kogman Date: Sat, 12 Apr 2008 15:49:20 +0000 (+0000) Subject: add notes for the 'equals' method borkedness X-Git-Tag: 0_55~231 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d46808bffa51c228f1bea63b8b22de815ab0bbda;p=gitmo%2FMoose.git add notes for the 'equals' method borkedness --- diff --git a/lib/Moose/Meta/TypeConstraint.pm b/lib/Moose/Meta/TypeConstraint.pm index a10fffc..618b6b4 100644 --- a/lib/Moose/Meta/TypeConstraint.pm +++ b/lib/Moose/Meta/TypeConstraint.pm @@ -93,6 +93,16 @@ sub equals { my $type = Moose::Util::TypeConstraints::find_type_constraint($type_or_name); + # this is so utterly broken + # any anon type constraint equals any other, because their names are both '__ANON__' + # I think the correct implementation is: + # refaddr == refaddr + # || + # constraint_coderef == constraint_coderef && parent->equals(parent) + # but we need tests first + # the Enum constraint can compare it's elements in a subclass + # refaddr eq will DWIM for all registered types + # the Class tc will already do the right thing even if the name is different $self->name eq $type->name; }