Just tried some experiments and I'm finding this a wierd function. I have an array of objects I'm gonna replace with a linked list. As per my previous thread, I've a subtype object within another type.
TYPE dog
Field stuff
END TYPE
TYPE cat
Field pet.dig
ENDTYPE
With an array of 50 cats, I have 50 dog sub-objects too. Now after creating all this objects I text certain values...
a=Handle(cats(5)\dog)
b=Handle(cats(6)\dog)
c=Handle(cats(7)\dog)
Text 10,20,a
Text 10,40,b
Text 10,60,c
Regardless of which index I use, a,b and c are always = 1,2,3 respectively.
Does Handle() record the object's location in an internal array? That seems to be the case. And object.xxx() returns an object so stored in this Handle() array? There's no direct access to the memory location of an object, but all objects can be written to this handle array.
For me to construct a linked list of, given the above example, cats, I would have to use Handle() on every cat object I create. I could point each cat object to others using a .cat field and object.xxx(). What happens when a cat object is deleted? Let's say I have 50 cats, and Handle() them all. Now I delete the third cat I created. What happens to the Handle() index 3? What is I now create another cat? Does it fill the hole or get tagged on the end?
From the sounds of it it's only really n array much like my existing array. If there's no direct pointers a true linked list doesn't seem possible. Ultimately I'm wanting a list of objects where I can add and delete at will from the collection, with some creation creating several concurrent objects that need to be kept together. Inserting into a linked list is ideal. At the moment I need searching thorugh the array for the first available space large enough for the objects I'm adding, which is far from elegant!
TYPE dog
Field stuff
END TYPE
TYPE cat
Field pet.dig
ENDTYPE
With an array of 50 cats, I have 50 dog sub-objects too. Now after creating all this objects I text certain values...
a=Handle(cats(5)\dog)
b=Handle(cats(6)\dog)
c=Handle(cats(7)\dog)
Text 10,20,a
Text 10,40,b
Text 10,60,c
Regardless of which index I use, a,b and c are always = 1,2,3 respectively.
Does Handle() record the object's location in an internal array? That seems to be the case. And object.xxx() returns an object so stored in this Handle() array? There's no direct access to the memory location of an object, but all objects can be written to this handle array.
For me to construct a linked list of, given the above example, cats, I would have to use Handle() on every cat object I create. I could point each cat object to others using a .cat field and object.xxx(). What happens when a cat object is deleted? Let's say I have 50 cats, and Handle() them all. Now I delete the third cat I created. What happens to the Handle() index 3? What is I now create another cat? Does it fill the hole or get tagged on the end?
From the sounds of it it's only really n array much like my existing array. If there's no direct pointers a true linked list doesn't seem possible. Ultimately I'm wanting a list of objects where I can add and delete at will from the collection, with some creation creating several concurrent objects that need to be kept together. Inserting into a linked list is ideal. At the moment I need searching thorugh the array for the first available space large enough for the objects I'm adding, which is far from elegant!