The problem is that objects carry attributes and can be shared. If you change an attribute on a shared object, you change it everywhere the object is used. The only way to avoid this often disasterous side effect is to copy the object and then put the new attribute on the copy. However, unlike other types of objects, Arrays can be *very* costly to copy, so we try to avoid it by hiding the interface to do so and, in doing so, confuse the crap out of everybody.
IMHO, the right thing to do here is to create a new object, ArrayData, that actually carries data, and let Array reference an ArrayData object rather than hold the data itself. By doing so we separate the header, which carries the semantics of how the data is used (eg. "dep" and "ref" attributes) from the data itself. We then preclude the attachment of attributes on ArrayData objects. Now, if we want to change the semantics of an Array object, we can copy it cheaply, creating a new Array object that references the same ArrayData object. Greg David Thompson <[EMAIL PROTECTED]>@opendx.watson.ibm.com on 07/26/2001 02:29:06 PM Please respond to [email protected] Sent by: [EMAIL PROTECTED] To: [email protected] cc: Subject: [opendx-dev] dxfReallyCopyArray/CopyArray Why is there no DXCopyArray function available as a function call? I just ran into an interesting situation where I need to update a bunch of components attributes (changing from one ref to another) and found that it changes it globally. Reading in the source code, I see that the Options module has to use a function _dxfReallyCopyArray and reading further find that it is required because attributes are attached to arrays. So why isn't this function available? Is there another way around it? I propose that this be made available--and will do it if it is agreed that it should be available. -- ............................................................................. David L. Thompson Visualization and Imagery Solutions, Inc. mailto:[EMAIL PROTECTED] 5515 Skyway Drive, Missoula, MT 59804 Phone : (406)257-8530
