[fpc-pascal] for..in loops?
Dean Zobec
dezobec at tin.it
Sun Nov 20 13:26:00 CET 2005
Lukas Gebauer wrote:
>>foreach ... in ... do adds no additional abstraction layer. I consider
>>foreach usefull if it allows to create own iterators which are as fast as
>>walking a linked list with p:=p^.next; Especially since it then allows
>>e.g. to write iterators with data prefetching.
>>
>>
>
>Just my two cents:
>
>For-in loops is standard part of Delphi-2006 pascal language. (Not only
>for .NET, it is for Win32 too!)
>
>I think, if Freepascal wish to stay Delphi compatible, then is good idea
>to implement this features too. Look to next Pascal language enhancements
>in Delphi-2006... (like operator overloads or class variables...)
>
>
I don't see it as a high priority. It takes some minutes to change the
code implemented with a for-in loop if it's needed.
What does Free Pascal need is a good type safe containers library and
probably this is the reason why the compiler team is concentrated on the
implementation of generics: provide strong type safety on containers in
the spirit of pascal.
And using a containers library you can allways use iterators, it's not a
language feature.
I'm happy that the compiler guys do not waste their precious time over
sintactic sugar issues.
>Look to next Pascal language enhancements
>in Delphi-2006... (like operator overloads or class variables...)
we already have them in free pascal for a couple of years iirc and I've never used them.
Ciao,
Dean
More information about the fpc-pascal
mailing list