[Gambas-devel] About List interface
Tobias Boege
tobias at ...692...
Thu Aug 30 04:18:16 CEST 2012
Hi Benoit,
I think the current List class follows your suggestions but there are some
critical points:
1. Enumeration
I use the List.Current as the enumeration pointer as this seems conclusive:
For Each List
Print List.Current ' All items
Next
This makes of course problems in nested loops with triggered BREAK. The
current implementation works somewhat cruel internally (until I incorporate
List.Take() into the enumeration state updating) that the user may not
understand what is going on.
My question therefore: Should List.Current not be modified at all during
For Each or should the limitations written down?
2. Enumeration (2)
>From where shall the enumeration start? From the beginning or the Current
node?
3. Prepend and the first Current
When the first element is added to the List, it automatically gets Current.
Before, there is none. If afterwards another element gets Prepend()'d,
Current is the second node without the user doing anything on Current. Is
this logical enough?
Remarks
I have the ususal test project and some benchmarks so far. Interestingly,
the current implementation cannot beat Variant[] even in best cache locality
order of operations... by a hair's breadth ;-)
I'll continue with improving the List internally and looking for rbtrees.
Regards,
Tobi
More information about the Devel
mailing list