Re: Is it necessary to call make_immutable in parent class?

[email protected] (Justin Yao)
Newsgroups perl.moose
Message-ID <[email protected]>
Hi Stevan,

Thanks for your clarification.
This OO framework really helps a lot in my projects.

Thank you.

Justin

Stevan Little wrote:
> 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
>>
> 

-- 
Justin Yao
Snooth
o: 646.723.4328
c: 718.662.6362
[email protected]

Snooth -- Over 2 million ratings and counting...
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.