Yes. Neither `population' nor `nextGeneration' is
actually an array; both are references to array objects.
Here's a crude schematic:
population -> [a,b,c]
nextGeneration -> [x,y,z]
When you execute `population = nextGeneration' you redirect
the upper arrow to point to the lower array object. If there
are no other references to the upper array, it becomes
eligible for garbage collection.
One important point though, is that after 'population = nextGeneration' both
population and nextGeneration refer to the *same* array.
If your CreateNextGeneration() method simply "populates" the array
nextGeneration, then you will also change the data which population refers
to. You need to make sure that CreateNextGeneration() creates a new array.
Thanks.
CreateNextGeneration() does create a new local array, nextGeneration, and
fills it with new Genomes. It does some stuff and then finally reassigns
population: 'population = nextGegeration;'.
Re: Test if memory pointer is valid? ... I can see setting a new pointer initially to the address of the beginning of an array, for example, and then incrementing the pointer to address subsequent elements, but that would usually be done inside a function, where the new pointer would go out of scope at the end of the function and be reinitialized if it is called again. ... I would like to see a specific example where it is necessary to have multiple references such as this where it would be necessary to check for it having been freed. ... copies of all the TLabel references already in the form as individual ... (comp.lang.pascal.delphi.misc)
Re: UBound not in Intellisense. References problem? ... but you can produce an array by using Value ... I wouldn't worry about it not appearing in intellisense.... > I wonder if I have a corruption in my registration of References,... I get UCase, UCase$, but no UBound.... (microsoft.public.excel.programming)
Re: How come Ada isnt more popular? ... The language does not require array implementation to be contiguous. ... then But non contigous representation of arrays will really stress ... It's easy with value-oriented languages (i.e. languages ... use references because of that. ... (comp.lang.ada)
Re: Reclaiming Memory ... example, handles to device context, memory addresses, etc.), VB is actually ... VB will clean up references to objects all ... It's a little unusual to use an array to store object references. ... unusual to use a variant array for what you apparently are (at least I'VE ... (microsoft.public.vb.com)
Re: list implementation ... >I believe the type "list" is implemented as an array of pointers.... A Python list is sematically/behaviorally defined as a mutable extensible ... the references are arrays of C pointers. ... (comp.lang.python)