The unlinking occurs when you create the class, not when you invoke it, so the cost of unlinking only occurs once.
On Fri, Feb 13, 2009 at 1:37 AM, cpt.oneeye (via Nabble) < [email protected]<ml-user%[email protected]> > wrote: > > Does that mean, that you will have performance-problems when you save > big arrays of objects (witch childen etc.) as an option? Does > MooTools copy the object when you add it as an option? > > On Feb 1, 8:31 pm, nutron > <anut...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2320344&i=0>> > wrote: > > > MooTools 1.2 (and all previous instances of the library) unlink child > > members of options to prevent class pollution. Consider: > > var Widget = new Class({ > > options: { > > fruits: { > > apples: 'red' > > } > > }}); > > > > //imaging that we do not unlink options.fruits > > var first = new Widget(); > > var second = new Widget(); > > > > first.options.fruits.apples = 'green'; > > //you have now changed fruits.apples for the second instance, too > > > > MooTools 1.3 will fix this problem though. The sub-objects will inherit > from > > their parents without affecting existing instances. > > > > -aaron > > > > On Sun, Feb 1, 2009 at 5:56 AM, jtreitz (via Nabble) < > > ml-user+75205-713932...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2320344&i=1> > <ml-user%2b75205-713932...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2320344&i=2>> > > > > > > > > > > > > > > wrote: > > > > > Hey guys, > > > > > Recently I ran into some trouble with classes having parents and > > > childs. Seems to me that setOptions unlinks every object reference in > > > the given options array? I'm pretty sure it is intended to do so, so > > > my question is: why and what should I do instead? > > > > >http://nopaste.ch/e9f8771226015cc.html > > > > > Thank you > > > > > Johannes > > > > > ------------------------------ > > > View message @ > > >http://n2.nabble.com/Options-unlinks-object-references--tp2253849p225... > > > > To start a new topic under MooTools Users, email > > > ml-node+660466-1583815...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2320344&i=3> > <ml-node%2b660466-1583815...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2320344&i=4>> > > > > To unsubscribe from MooTools Users, click here< (link removed) >. > > > > ----- > > The MooTools Tutorial: http://www.mootorial.comwww.mootorial.com > > Clientcide: http://www.clientcide.comwww.clientcide.com > > -- > > View this message in context: > http://n2.nabble.com/Options-unlinks-object-references--tp2253849p225... > > Sent from the MooTools Users mailing list archive at Nabble.com.- Hide > quoted text - > > > > - Show quoted text - > > > ------------------------------ > View message @ > http://n2.nabble.com/Options-unlinks-object-references--tp2253849p2320344.html > To start a new topic under MooTools Users, email > [email protected]<ml-node%[email protected]> > To unsubscribe from MooTools Users, click here< (link removed) >. > > > ----- The MooTools Tutorial: http://www.mootorial.com www.mootorial.com Clientcide: http://www.clientcide.com www.clientcide.com -- View this message in context: http://n2.nabble.com/Options-unlinks-object-references--tp2253849p2322512.html Sent from the MooTools Users mailing list archive at Nabble.com.
