Yes...well this is what I had to find out, and as you said, again
Delphi's own documentation and most of what you come across when searching
the subject with Delphi as one of the parameters, they confuse the issues I
was worrying about.  In my head I knew already that this is just another
container type, however due to the language's abilities to directly
reference the objects and its properties directly from the array such as for
an array of type TMyObject you can, MyArray[selected
element].object-property.read/write; I was again confused into thinking
there might actually be something else there as well.  
        What I'm glad I finally did get out of my questioning was Rob's
information on how use within an array inhibits the normal reference
counting Delphi uses as I never would have considered that and would have
ended up with some pretty nasty memory leaks that would be difficult to
account for! <g>  I personally consider this difficulty a very un-natural
condition that should have been accounted for properly by the compiler.
Looking into this mystery I learned things about the way Delphi manages
strings and other reference counted objects that I didn't know about.  There
are probably many very good reasons for why they did these things as they
did, but just from my shortsighted view of it all I think I would have
handled these things a little closer to the bone...meaning that I would have
made the allocation and freeing of memory needed for their dynamic sizing a
part of the objects themselves.  I've never been comfortable with the
concept of an object's use affecting its natural behaviour.  Allowing such
is bad design.  Had Delphi been designed from the ground up with this type
of resource handling in  mind I'm sure they would have done it a little
differently from what they at a later date, had to come up with to make it
all fit together as well as it does even with the few minor discrepancies
they had to allow for.       

from Robert Meek dba Tangentals Design  CCopyright 2006

"When I examine myself and my methods of thought, I come to the conclusion
that the gift of Fantasy has meant more to me then my talent for absorbing
positive knowledge!"
                                                    Albert Einstein


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Jim Burns
Sent: Thursday, March 09, 2006 7:18 PM
To: 'Borland's Delphi Discussion List'
Subject: RE: Objects and Lists...addendum -> Strings

> what is or isn't dynamic about it. 
> what about individual object properties such as long-strings
> which themselves are dynamic.   Can a dynamic
> array deal safely with objects that hold dynamic properties 
> or variables by themselves or do I have to deal with this in
> another way?

Well, your use of the term "dynamic" is being applied to the wrong end there
Robert.  Dynamic arrays and strings are dynamic in that they themselves can
be sized and resized dynamically on the fly at runtime, NOT because they
take on any care or concern about what's contained within them.

TObjectList on the other hand is specifically for maintaining a list of
"owned" objects, which of course comes with it the addition of being able to
assume more duties for you when you wish to destroy that object.

But you shouldn't confuse TObjectList's ability to handle this for you as
the default way things are done.  In fact, it's made must simplier because
of Delphi's "object-based hierarchy" where there is a master ancestor class.
But this is an extension, and a good one, I've never used such a class
myself before preferring to to retain "pilot in command" status for myself,
but remember the concept of "container" doesn't intrinsically include the
concept of "owner."  This was simply an natural OOP evolution.  


Let me also suggest again this is another example of how allowing a language
to "hide" scary things like pointers fails us all.  If Delphi made it plain
that your array was simply holding references to other objects you'd also
clearly see the distinction between the elements and objects involved.  It'd
be right there in the language.  I'm all for making things simple, but
there's enough the compiler does I depend on and don't want to know about,
but "references to other things" is a primative concept that will not go
away.



> From what I gathered simple dynamic arrays can be looked at like

They should be looked at like arrays.  They're dynamic in that you can
allocate and deallocate them at runtime, otherwise, they have no other
special properties, they are arrays.



Jim


------------------------------------------------------------------------
 Jim Burns, <mailto:[EMAIL PROTECTED]>
   Technology Dynamics
   Pearland, Texas  USA 
   281 485-0410 / 281 813-6939

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to