Hi,

On 14.10.19 15:44, Ryan Joseph wrote:
var
   it: pointer;
   obj: TObject;
begin
   for it in list do
     begin
       obj := TObject(it);
       // continue on like before using “obj” instead of “it"
     end;


That’s our realistic best use case now but it requires 2 extra steps. I hope 
there’s a better solution to keep the for-in loops as easy to use as before.

you could do

var
  it: pointer;
  obj: TObject absolute it;
begin
  for it in list do
    begin
      // continue on like before using “obj” instead of “it"
    end;


Cheers,
Benito

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to