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;
# 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;
=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)>
=back
-=head1 AUTHOR
+=head1 AUTHORS
Yuval Kogman E<lt>nothingmuch@woobling.comE<gt>