This may be a question for Christof or someone with similar deep knowledge
of how VFP works.
I use arrays a LOT.
I DIMENSION, ASCAN(), ADEL(), and ASORT() them, and consult their ALEN()s
constantly. I iterate through them and perform actions on their elements
repeatedly. Sometimes I even AINS() them.
I'm thinking it would be wise to create a class that encapsulates this
stuff and clean out all my duplicated use of those commands and functions.
It certainly would put an end to unexpected "Array dimensions invalid"
errors when I forget to check an ALEN() somewhere.
I think the class would have an array property, and methods to carry out
those functions on it. Whenever I need an array I'd instanciate the class,
if necessary ADDOBJECTing it to another object.
I can easily see how to do this.
My question is, what is the "weight" of having potentially several dozen
instances of this array object hanging around in memory, even if, for some
of them, I will only need one or two of the object's capabilities? Is this
a bigger drain on resources than just duplicating array manipulation code
whenever I need it?
I'm thinking that I remember hearing that VFP only really stores one
instance of a class's structure in memory no matter how many times it's
instanciated in code, then uses reference counters and maybe some kind of
"diff" function to keep track of the values of the class properties
associated with each instance. If that's true, maybe this isn't something
to worry about.
I know that the answer is "Test it and find out." Writing a test of this
proposition will probably take longer than creating the class, and creating
the class will take a while, considering all the stuff I want in it. So if
it wouldn't take someone very long to answer this question, I would sure
appreciate it.
Thanks.
Yours in Keeping VFP Something to Talk About,
Ken Dibble
www.stic-cil.org
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.