[fpc-devel] New feature discussion: for-in loop

Graeme Geldenhuys graemeg.lists at gmail.com
Tue Oct 20 10:08:38 CEST 2009


2009/10/20 Alexander Klenin <klenin at gmail.com>:
>
> for-in is just a syntax sugar plus standard interface for the cost common usage
> of iterators. So they are not mutually exclusive at all.

Another flaw in the for-in concept...

  What will this do:

  for y in MyList do
  begin
    if y = XXX then
      MyList.Add(YYY);
    if y = ZZZ then
      MyList.Insert(1, AAA);
  end;

With my iterator implementation I can handle this with no problems,
and ever make the resulting behaviour user-selectable with parameters
to the MyList.GetIterator method.


-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list