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

Paul Ishenin ip at kmiac.ru
Tue Oct 20 10:20:29 CEST 2009


Michael Van Canneyt wrote:

> At least one of the reasons we never did implement for-in is the absolutely
> horrible and totally wrong idea to use classes/interfaces for this, to 
> which
> I seriously objected.

Reading this I conclude you are against 'for-in' implementation in fpc.

> I can understand
>   for y in enumerated do
> or
>   For y in set do
> or
>   For Y in range do
> Because this seems a natural extension of loops to enumerates (and even
> then) But not ever the class-based one.

So you are not against it but you want to allow them only for the base 
types?

I hope you understand that ppl will use them for classes anyway?

var
   P: Pointer;
begin
   for P in GetComponents(Component) do
     TComponent(P).DoSomething;
end;

And what is so special in the class type?

Best regards,
Paul Ishenin.




More information about the fpc-devel mailing list