[Gambas-devel] About List interface

Benoît Minisini gambas at ...1...
Fri Aug 31 20:08:56 CEST 2012


Le 31/08/2012 13:57, Tobias Boege a écrit :
>
> 4. Backwards enumeration
> I'd like to enable the user to For Each backwards. What would that look
> like? I thought of a property named Backwards which sets a bit in the List
> to start the next enumeration as backwards and returns itself. It would
> look like this then:
>
> For Each List.Backwards
> 	Print List.Current ' All items backwards
> Next
>
> What do you think?

As I said before, each enumeration must be indepedent of List.Current.

Moreover, the syntax should be compatible with other container classes 
(Array and Collection):

Dim vElt As Variant

For Each vElt in TheList
   ...
Next

Anyway, if you want you can implement:

For Each vElt in TheList.Backwards
   ...
Next

But then the Backwards property should use GB_RETURN_SELF() and returns 
a virtual class (named ".List.Backwards") having just its own "_next" 
enumerator.

Regards,

-- 
Benoît Minisini




More information about the Devel mailing list