[Prototype-core] Re: Error/counter-intuitive Class-inheritance?

2007-08-20 Thread Mislav Marohnić
On 8/20/07, Somebee [EMAIL PROTECTED] wrote:


 When you push values into an array on an object, the values of the
 class/prototype-array is also changed.


You've been bitten by the fact the array is copied by reference, not by
value. You should be setting the initial value for instance variables in the
constructor: http://pastie.caboo.se/89338

I'm not sure if this is something we should fix or not. In a way, the
framework might deal with this situations in order to follow the POLS
(principle of least surprise). We need to discuss this internally.

Anyway, do as I suggested for now. This might change in release 1.6.1.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: Error/counter-intuitive Class-inheritance?

2007-08-20 Thread Sam Stephenson

On Aug 20, 2007, at 11:51 AM, Mislav Marohnić wrote:

You've been bitten by the fact the array is copied by reference, not  
by value. You should be setting the initial value for instance  
variables in the constructor: http://pastie.caboo.se/89338


I'm not sure if this is something we should fix or not. In a way,  
the framework might deal with this situations in order to follow the  
POLS (principle of least surprise). We need to discuss this  
internally.


Anyway, do as I suggested for now. This might change in release 1.6.1.


There is nothing to fix here.  This is the exact problem that  
constructors solve.  I don't think it's surprising, and we won't be  
changing it.


-sam



smime.p7s
Description: S/MIME cryptographic signature