Switch to duck typing
gfx [Wed, 16 Dec 2009 08:37:19 +0000 (17:37 +0900)]
lib/Mouse/Util.pm

index 37b615a..107f700 100644 (file)
@@ -81,9 +81,14 @@ BEGIN {
     *get_all_metaclass_names     = \&Mouse::Meta::Module::_get_all_metaclass_names;
 
     # is-a predicates
-    generate_isa_predicate_for('Mouse::Meta::TypeConstraint' => 'is_a_type_constraint');
-    generate_isa_predicate_for('Mouse::Meta::Class'          => 'is_a_metaclass');
-    generate_isa_predicate_for('Mouse::Meta::Role'           => 'is_a_metarole');
+    #generate_isa_predicate_for('Mouse::Meta::TypeConstraint' => 'is_a_type_constraint');
+    #generate_isa_predicate_for('Mouse::Meta::Class'          => 'is_a_metaclass');
+    #generate_isa_predicate_for('Mouse::Meta::Role'           => 'is_a_metarole');
+
+    # duck type predicates
+    generate_can_predicate_for(['_compiled_type_constraint']  => 'is_a_type_constraint');
+    generate_can_predicate_for(['create_anon_class']          => 'is_a_metaclass');
+    generate_can_predicate_for(['create_anon_role']           => 'is_a_metarole');
 }
 
 our $in_global_destruction = 0;