So correct me if I'm wrong on any of this, but to my knowledge, this is how Ash handles the removal of nodes:
If an Entity is removed or it loses one/many of its components, each ComponentMatchingFamily will attempt to removeIfMatch() on the Entity to remove it from its NodeList if it no longer meets the proper component requirements. If the Engine is updating - which it in most cases will be - it will cache() the node in the NodePool and then dispose() of all the nodes at the end of the update.
My issue lies in NodePool.cache().
internal function cache( node : Node ) : void
{
node.previous = cacheTail;
cacheTail = node;
}
Say for example I have an AlphabetSystem, and at the start of that system it sorts the NodeList based on an Alphabet component's place in the alphabet. Now all of the Nodes are sorted A-Z. Say later in the system, I either want to iterate through the NodeList A-Z OR Z-A. That would mean I either do:
for(var node:AlphabetNode = nodeList.head; node; node = node.next)
{
//Some kind of code
}
OR
for(var node:AlphabetNode = nodeList.tail; node; node = node.previous)
{
//Some other kind of code
}
Wouldn't that break the iteration of the latter example if caching a Node into the NodePool overrides node.previous??