One thing for sure, I probably will very much never need to declare TThread inherited classes. I can use a single anonymous method for that, thanks to the ability of the anonymous method to capture local and member variables. This is something not doable with closure as it has fixed number of parameters ;-) .

With best regards,
Boian Mitov

-------------------------------------------------------
Mitov Software
www.mitov.com
-------------------------------------------------------
-----Original Message----- From: Boian Mitov
Sent: Sunday, March 03, 2013 8:54 PM
To: FPC developers' list
Subject: Re: [fpc-devel] Delphi anonymous methods

Here is example:

Parallel execution with selection of executor:

for i := 0 to AMaxScaleIndex - 1 do
 begin
 APerIterationLocations.Add( TRTDynamicList<TVLImageRect>.Create() );
 AExecutionTask.Add( AExecutor.Execute(
     procedure()
     begin
       ProcessOne( levelScale[ i ], img, hitThreshold, winStride, padding,
APerIterationLocations[ i ] );
     end
   ));

 end;

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to