List errors in monkey v49Hidden Forums/Bug Bin/List errors in monkey v49
| I am getting errors when using the lists from monkey v49 (upgraded from v44).|
One problem was when I did the following, if NextNode was NULL then it would throw an error when trying to get Value().
b = buglist.GetFirst() While b b = b.bugnode.NextNode().Value() Wend
So to fix, HeadNode.GetNode() should return Self, not Null.
Class HeadNode<T> Extends Node<T> Method New() _succ=Self _pred=Self End Method GetNode:Node<T>() Return Self '' do not return Null End End
The problem with the above is if people are using NextNode() as the While-Wend check, then NextNode and PrevNode methods would have to return Null if it encounters _head. May slow down list iteration, but it seems cleaner to allow Node.Value() for While-Wend checking.
After I wrote this, I see now the FirstNode() method to allow Node iteration. I guess this is not a bug, but a different way of dealing with lists. I still think it may be cleaner with the above method, but am open to suggestions.