Hi Derrell,
>  Hmmm... How to answer that...
>
> What we're talking about here is a feature of the JavaScript language 
> that is very useful. Objects (including Arrays) can become very large. 
> Instead of passing copies of objects and arrays around, and taking the 
> possibly large amount of time required to make those copies, only a 
> single copy of each object is created, and when assigned to another 
> variable or passed to a function or method, a reference to that object 
> is passed. For function calls, this is typically referred to as "call 
> be reference" instead of "call by value." (Scaler types are passed by 
> value.)
> So is it a bug or a feature? It is certanly a JavaScript feature. I 
> suppose that one might have designed qx.Class.define() a bit 
> differently, and placed into the members portion of the map only a 
> list of member variables (implicitly asking that they each be added to 
> the prototype with a value of null), and requiring that all member 
> variables be initialized in the constructor. This would have prevented 
> the "issue" (I like that word better than "problem" in this context) 
> that we're seeing here because there would be no opportunity to have a 
> reference type added to the prototype. On the other hand, it would 
> complicate the code (to a fairly large extent, with many classes with 
> lots of scaler initialization) by forcing initialization of every 
> member variable in the constructor, rather than in the much cleaner 
> representation of the members: section of the map.
>
> So there are the pros and cons. That should provide some food for thought.
Very clear and extensive explanation of the problem with "pass by 
reference" data types used in maps :)

Thanks Derrell, for the time and the effort :)

cheers,
skar.

-- 
--
The life so short, the craft so long to learn. 


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to