foo
[gitmo/Moose.git] / lib / Moose.pm
index 1ddde47..628a9e6 100644 (file)
@@ -4,7 +4,7 @@ package Moose;
 use strict;
 use warnings;
 
-our $VERSION = '0.13';
+our $VERSION = '0.17';
 
 use Scalar::Util 'blessed', 'reftype';
 use Carp         'confess';
@@ -34,6 +34,7 @@ use Moose::Util::TypeConstraints;
         subtype $class
             => as 'Object'
             => where { $_->isa($class) }
+            => optimize_as { blessed($_[0]) && $_[0]->isa($class) }            
         unless find_type_constraint($class);
 
         my $meta;
@@ -140,23 +141,29 @@ use Moose::Util::TypeConstraints;
         },
         
         # NOTE:
-        # this is experimental for now ...
-        self => sub {
-            return subname 'Moose::self' => sub {};
-        },        
-        method => sub {
-            my $class = $CALLER;
-            return subname 'Moose::method' => sub {
-                my ($name, $method) = @_;
-                $class->meta->add_method($name, sub {
-                    my $self = shift;
-                    no strict   'refs';
-                    no warnings 'redefine';
-                    local *{$class->meta->name . '::self'} = sub { $self };
-                    $method->(@_);
-                });
-            };
-        },                
+        # this is experimental, but I am not 
+        # happy with it. If you want to try 
+        # it, you will have to uncomment it 
+        # yourself. 
+        # There is a really good chance that 
+        # this will be deprecated, dont get 
+        # too attached
+        # self => sub {
+        #     return subname 'Moose::self' => sub {};
+        # },        
+        # method => sub {
+        #     my $class = $CALLER;
+        #     return subname 'Moose::method' => sub {
+        #         my ($name, $method) = @_;
+        #         $class->meta->add_method($name, sub {
+        #             my $self = shift;
+        #             no strict   'refs';
+        #             no warnings 'redefine';
+        #             local *{$class->meta->name . '::self'} = sub { $self };
+        #             $method->(@_);
+        #         });
+        #     };
+        # },                
         
         confess => sub {
             return \&Carp::confess;
@@ -289,9 +296,6 @@ to be evolving. Much of the outer API is stable, but the internals
 are still subject to change (although not without serious thought 
 given to it).  
 
-For more details, please refer to the L<FUTURE PLANS> section of 
-this document.
-
 =head1 DESCRIPTION
 
 Moose is an extension of the Perl 5 object system.