[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

Bernd prof7bit at googlemail.com
Sat Nov 5 20:02:42 CET 2011


2011/10/25 Marco van de Voort <marcov at stack.nl>:
> Equivalent solution with anon functions:
>
> targethread.queue(
>   procedure(targetobject:ttargetobject;a:integer;b:someobject;c:string)
>              begin
>                targetobject.destinationprocedure(a,b,c);
>              end;

shouldn't this be

targethread.queue(
      procedure
             begin
               targetobject.destinationprocedure(a,b,c);
             end;

without any parameters since all these variables are captured from the
current scope into the closure? The other thread should not need to
know anything about them to call it.



More information about the fpc-pascal mailing list