Hey fish,
It can sometimes be useful to store the 'link' in objects if they're only ever gonna be in a single list, ala Blitz2D/3D/Plus.
While not quite as easy as the old system, it's potentially more flexible...
you have to be careful with iterators over collections and operations that modify the backing collection.
Oh yes!
However, I've designed the Max lists so it's always safe to remove the 'current' object when iterating over a list with EachIn, but it still pays to be careful!
It can sometimes be useful to store the 'link' in objects if they're only ever gonna be in a single list, ala Blitz2D/3D/Plus.
Type MyThing Field link:TLink Method AddToList( list:TList ) RemoveFromList 'if we were already in a list, remove us. link=list.AddLast( self ) 'track the new list we're in... End Method Method RemoveFromList() If link link.Remove ; link=Null End Method End Type Local thingList:TList=new TList Local t:MyThing=new MyThing t.AddToList thingList For thing:MyThing=EachIn thingList 'Do something with each thing Next
While not quite as easy as the old system, it's potentially more flexible...
you have to be careful with iterators over collections and operations that modify the backing collection.
Oh yes!
However, I've designed the Max lists so it's always safe to remove the 'current' object when iterating over a list with EachIn, but it still pays to be careful!