ChangeLog and adding yuval to authors everywhere
[gitmo/Class-MOP.git] / lib / Class / MOP / Instance.pm
index f9a34da..9a143bc 100644 (file)
@@ -4,9 +4,9 @@ package Class::MOP::Instance;
 use strict;
 use warnings;
 
-use Scalar::Util 'weaken';
+use Scalar::Util 'weaken', 'blessed';
 
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 
 sub meta { 
     require Class::MOP::Class;
@@ -100,6 +100,13 @@ sub strengthen_slot_value {
 
 # inlinable operation snippets
 
+sub is_inlinable { 1 }
+
+sub inline_create_instance {
+    my ($self, $class_variable) = @_;
+    'bless {} => ' . $class_variable;
+}
+
 sub inline_slot_access {
     my ($self, $instance, $slot_name) = @_;
     sprintf "%s->{%s}", $instance, $slot_name;
@@ -256,6 +263,16 @@ ignore this for now.
 
 =over 4
 
+=item B<is_inlinable>
+
+Each meta-instance should override this method to tell Class::MOP if it's 
+possible to inline the slot access. 
+
+This is currently only used by Class::MOP::Class::Immutable when performing 
+optimizations.
+
+=item B<inline_create_instance>
+
 =item B<inline_slot_access ($instance_structure, $slot_name)>
 
 =item B<inline_get_slot_value ($instance_structure, $slot_name)>
@@ -272,7 +289,7 @@ ignore this for now.
 
 =back
 
-=head1 AUTHOR
+=head1 AUTHORS
 
 Yuval Kogman E<lt>nothingmuch@woobling.comE<gt>