Marc Weustink wrote:
I can see a use for using iterators in a for loop, however they should be declared with some keyword.

Something like

type
  TListIterator = iterator(TList, init_func, next_func, check_func)
    function init_func: Boolean;
    function next_func: <element type>
    function check_func: Boolean;
  end;

begin
  for element in list using TListIterator do...

IMO this is more pascal than using some interface or predefined function names.
Good idea. What is iterator internally? Is this an object with the special header?

Is it internall the same as:
TListIterator = object
 function init_func(AList: TList): Boolean;
 function next_func: Pointer;
 function check_func: Boolean;
end;

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

Reply via email to