Martin wrote:
"using" seems far better than a "fixed name GetIterator procedure".

IMHO the other option is to implement the feature for ase types (e.g. enum, array, maybe string) and allow operator overriding for all other types.

Then you can specify an enum operator for classes, or even for simple/scalar types like integer, and define your for..in behaviour for them.
Yes, 'using' and 'operator GetEnumerator' are suggested in the wiki page here: http://wiki.lazarus.freepascal.org/for-in_loop#Proposed_extensions
So at least here we are thinking the same :)

The big problem question is "what is enumerator" :

a) A new type very like to a specially defined object. If so then will we allow it usage outside for-in loop?
b) A class with one magic method and one magic property
c) something else

Best regards,
Paul Ishenin.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to