Revision history for Perl extension Class-MOP.
+
0.39
- * Class::MOP::Class::Immutable
+ * Class::MOP::Immutable
- added make_metaclass_mutable + docs (groditi)
- removed unused variable
- added create_immutable_transformer
t/070_immutable_metaclass.t
t/071_immutable_w_custom_metaclass.t
t/072_immutable_w_constructors.t
+t/073_make_mutable.t
t/080_meta_package.t
t/081_meta_package_extension.t
t/100_BinaryTree_test.t
-Class::MOP version 0.38
+Class::MOP version 0.39
===========================
See the individual module documentation for more information
use Class::MOP::Immutable;
-our $VERSION = '0.38';
+our $VERSION = '0.39';
our $AUTHORITY = 'cpan:STEVAN';
{
sub is_mutable { 1 }
sub is_immutable { 0 }
-#Why I changed this (groditi)
-# - One Metaclass may have many Classes through many Metaclass instances
-# - One Metaclass should only have one Immutable Transformer instance
-# - Each Class may have different Immutabilizing options
-# - Therefore each Metaclass instance may have different Immutabilizing options
-# - We need to store one Immutable Transformer instance per Metaclass
-# - We need to store one set of Immutable Transformer options per Class
-# - Upon make_mutable we may delete the Immutabilizing options
-# - We could clean the immutable Transformer instance when there is no more
-# immutable Classes of that type, but we can also keep it in case
-# another class with this same Metaclass becomes immutable. It is a case
-# of trading of storing an instance to avoid unnecessary instantiations of
-# Immutable Transformers. You may view this as a memory leak, however
-# Because we have few Metaclasses, in practice it seems acceptable
-# - To allow Immutable Transformers instances to be cleaned up we could weaken
-# the reference stored in $IMMUTABLE_TRANSFORMERS{$class} and ||= should DWIM
+# NOTE:
+# Why I changed this (groditi)
+# - One Metaclass may have many Classes through many Metaclass instances
+# - One Metaclass should only have one Immutable Transformer instance
+# - Each Class may have different Immutabilizing options
+# - Therefore each Metaclass instance may have different Immutabilizing options
+# - We need to store one Immutable Transformer instance per Metaclass
+# - We need to store one set of Immutable Transformer options per Class
+# - Upon make_mutable we may delete the Immutabilizing options
+# - We could clean the immutable Transformer instance when there is no more
+# immutable Classes of that type, but we can also keep it in case
+# another class with this same Metaclass becomes immutable. It is a case
+# of trading of storing an instance to avoid unnecessary instantiations of
+# Immutable Transformers. You may view this as a memory leak, however
+# Because we have few Metaclasses, in practice it seems acceptable
+# - To allow Immutable Transformers instances to be cleaned up we could weaken
+# the reference stored in $IMMUTABLE_TRANSFORMERS{$class} and ||= should DWIM
{
my %IMMUTABLE_TRANSFORMERS;
This method will reverse tranforamtion upon the class which
made it immutable.
+=item B<create_immutable_transformer>
+
+Create a transformer suitable for making this class immutable
+
=back
=head1 AUTHORS
use Carp 'confess';
use Scalar::Util 'blessed';
-our $VERSION = '0.01';
+our $VERSION = '0.02';
our $AUTHORITY = 'cpan:STEVAN';
sub new {
}
}
- #I'm not sure i understand this, stevan suggested the addition i don't think its actually needed
- #my $is_immutable = $metaclass->is_anon_class;
- #$self->immutable_metaclass->add_method('is_anon_class' => sub { $is_immutable });
-
$metaclass->{'___original_class'} = blessed($metaclass);
bless $metaclass => $self->immutable_metaclass->name;
}
if $immutable->get_method('DESTROY')->blessed eq $options{destructor_class};
}
- #14:01 <@stevan> nah,. you shouldnt
- #14:01 <@stevan> they are just inlined
- #14:01 <@stevan> which is the default in Moose anyway
- #14:02 <@stevan> and adding new attributes will just DWIM
- #14:02 <@stevan> and you really cant change an attribute anyway
- #if ($options{inline_accessors}) {
- # foreach my $attr_name ($immutable->get_attribute_list) {
- # my $attr = $immutable->get_attribute($attr_name);
- # $attr->remove_accessors;
- # $attr->install_accessors(0);
- # }
- #}
-
- #14:26 <@stevan> the only user of ::Method::Constructor is immutable
- #14:27 <@stevan> if someone uses it outside of immutable,.. they are either: mst or groditi
- #14:27 <@stevan> so I am not worried
+ # NOTE:
+ # 14:01 <@stevan> nah,. you shouldnt
+ # 14:01 <@stevan> they are just inlined
+ # 14:01 <@stevan> which is the default in Moose anyway
+ # 14:02 <@stevan> and adding new attributes will just DWIM
+ # 14:02 <@stevan> and you really cant change an attribute anyway
+ # if ($options{inline_accessors}) {
+ # foreach my $attr_name ($immutable->get_attribute_list) {
+ # my $attr = $immutable->get_attribute($attr_name);
+ # $attr->remove_accessors;
+ # $attr->install_accessors(0);
+ # }
+ # }
+
+ # 14:26 <@stevan> the only user of ::Method::Constructor is immutable
+ # 14:27 <@stevan> if someone uses it outside of immutable,.. they are either: mst or groditi
+ # 14:27 <@stevan> so I am not worried
$options{constructor_name} = 'new' unless exists $options{constructor_name};
if ($options{inline_constructor}) {
my $constructor_class = $options{constructor_class} || 'Class::MOP::Method::Constructor';
the immutable process. C<%options> should be the same options that were
given to make_metaclass_immutable.
-=item B<create_immutable_transformer>
-
-Create a transformer suitable for making this class immutable
-
=back
=head1 AUTHORS