[fpc-pascal] for..in loops?

Marco van de Voort marcov at stack.nl
Sun Nov 20 12:22:45 CET 2005

> Micha Nelissen said:
> > FPC will never support this, AFAIK. It doesn't really add anything new, it
> > just shortens the code somewhat. Only in toy examples is it nice,
> Could you expand this answer to cover the reasons why people might use
> Pascal rather than assembly language? Your argument seems to advocate
> using the lowest level language available...

> I'm a big fan of compact code and language features that promote it.
> Give me "StringList.SaveToFile()" any day over the laborious code
> that starts "var F:TextFile;"

These don't have the same properties. Using basic I/O one can work with
textfiles larger than the (virtual) memory. With stringlist there always
must be full in memory loading.
Moreover stringlists get painfully slow over a few ten thousand lines.

However stringlist _adds_ something. You can really do stuff in a few lines
that takes tons of manual coding.

FOR IN on the other hand saves only two lines of plain typing, something
that could even be compensated with a small Lazarus codetools "generate
construct" macro.

Moreover stringlist doesn't need compiler support to do it.

More information about the fpc-pascal mailing list