Well, I'm not sure what your algorithm is doing, so I can't give any specific advice, but perhaps these general items might help:
First, a (Custom) Type Declaration, as you know, is the "Type...Field...End Type" construct. Now, to clarify the difference between Type pointers and Type instances. A type instance is what's created here, AFTER the = sign, and a type pointer is what's created BEFORE the = sign.
Var.A = New A
Whenever "New <type>" is used, Blitz allocates a chunk of memory for a new instance of all the fields of that type. It then inserts it into the global type list for that particular type declaration. (i.e. every kind has its own list.) These can be referenced by using the commands First, Last, Each, Before, After, etc.
A type pointer is essentially just a value pointing to a single type instance. Once declared, it can point to any instance or none, and it can be local or global, like here:
Global var.A
In this case, var = Null (not pointing to any instance). You could later do any of these:
var = First A
var = Last A
var = After First A
var = var2 (assuming var2.A was previously declared)
For var = Each A (in which case var will be iterated through the entire list from First to Last)
Type pointers can be part of other constructs, including other type declarations, like you did above. They can also be part of arrays.
Dim vars.A(20)
Local vars.A[20]
...
So, having said all that, perhaps it gives you a better idea of how custom types are managed in Blitz, and consequently give you a better idea of what constructs and data types/structures you want to use.
First, a (Custom) Type Declaration, as you know, is the "Type...Field...End Type" construct. Now, to clarify the difference between Type pointers and Type instances. A type instance is what's created here, AFTER the = sign, and a type pointer is what's created BEFORE the = sign.
Var.A = New A
Whenever "New <type>" is used, Blitz allocates a chunk of memory for a new instance of all the fields of that type. It then inserts it into the global type list for that particular type declaration. (i.e. every kind has its own list.) These can be referenced by using the commands First, Last, Each, Before, After, etc.
A type pointer is essentially just a value pointing to a single type instance. Once declared, it can point to any instance or none, and it can be local or global, like here:
Global var.A
In this case, var = Null (not pointing to any instance). You could later do any of these:
var = First A
var = Last A
var = After First A
var = var2 (assuming var2.A was previously declared)
For var = Each A (in which case var will be iterated through the entire list from First to Last)
Type pointers can be part of other constructs, including other type declarations, like you did above. They can also be part of arrays.
Dim vars.A(20)
Local vars.A[20]
...
So, having said all that, perhaps it gives you a better idea of how custom types are managed in Blitz, and consequently give you a better idea of what constructs and data types/structures you want to use.