[Gambas-devel] About List interface

Benoît Minisini gambas at ...1...
Fri Aug 31 20:05:45 CEST 2012


Le 30/08/2012 04:18, Tobias Boege a écrit :
> 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?

Each enumeration has its own internal pointer. List.Current must be 
completely independent of all enumerations.

>
> 2. Enumeration (2)
>>From where shall the enumeration start? From the beginning or the Current
> node?

 From the beginning. If the user needs to start somewhere else, he will 
do it by hand.

>
> 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?

You can choose to make the last inserted element current, whatever the 
insertion method was.

Regards,

-- 
Benoît Minisini




More information about the Devel mailing list