On Thu, Oct 22, 2009 at 02:07, Sergei Gorelkin <sergei_gorel...@mail.ru> wrote: > As I tried to say earlier, having distinct StepNext() and Current() > functions is somewhat redundant, except the purpose of Delphi compatibility. > Rationale: the for..in loop manages the iterator object itself, and does not > allow user code inside the loop to access the iterator and call its > methods. Therefore, it is possible to reduce the whole thing to: > > function Next(out value: SomeType): Boolean; iterator; > > thus eliminating the need for additional qualifiers after 'iterator'.
This is slightly better, but IMO does not worth additional incompatibility. Also, your proposal is far less extendable: 1) Delphi iterators have also magic 'Reset' function which is easy to express by attribute "iterator reset", but hard to express in your proposal 2) See the end of the for-in wiki page for my proposal for optional "iterator index" extension, which is also non-trivial to do in your proposal. -- Alexander S. Klenin _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel