Re: Is it necessary to call make_immutable in parent class?
[email protected] (Stevan Little)
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
Justin, You need to call make_immutable on all classes, as it only affects the local class and not the superclasses. - Stevan On Nov 4, 2008, at 2:06 PM, Justin Yao wrote: > Hi, > > I am new to Moose and I love this framework. > I have a question regarding to making class immutable. > Suppose I have a class hierarchy as below: > > A > / > B > / \ > C D > > B is the parent class of C and D. > A is the parent class of B. > > Now I want to make class C immutable. > > My question is "when I call C->meta->make_immutable(), does it apply > to only the meta class of C or apply to all its parent classes (B,A) > but within class C's namespace? In other words, after making class C > immutable, will it introspect the structure of Class A and B when I > create a new object? Do I need to call make_immutable for class B > and A If I want to make Class C immutable?" > > Thanks, > -- > Justin Yao >