<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial'; COLOR: #000000">
<DIV> Hmm.... the last time I checked this was anonymous methods... Are
you sure I was talking closures?</DIV>
<DIV> </DIV>
<DIV>FThread1.Process(</DIV>
<DIV> procedure()</DIV>
<DIV> var</DIV>
<DIV> ANewText1 : String;</DIV>
<DIV> </DIV>
<DIV> begin</DIV>
<DIV> Sleep( 500 ); // Simulate thread busy doing
time consuming task</DIV>
<DIV> ANewText1 := AText + ' + Thread1';</DIV>
<DIV> </DIV>
<DIV> FThread2.Process(</DIV>
<DIV> procedure()</DIV>
<DIV> var</DIV>
<DIV>
ANewText2 : String;</DIV>
<DIV> </DIV>
<DIV> begin</DIV>
<DIV> Sleep(
500 ); // Simulate thread busy doing time consuming task</DIV>
<DIV>
ANewText2 := ANewText1 + ' + Thread2';</DIV>
<DIV> </DIV>
<DIV>
FThread3.Process(</DIV>
<DIV>
procedure()</DIV>
<DIV>
var</DIV>
<DIV>
ANewText3 : String;</DIV>
<DIV> </DIV>
<DIV>
begin</DIV>
<DIV>
Sleep( 500 ); // Simulate thread busy doing time consuming task</DIV>
<DIV>
ANewText3 := ANewText2 + ' + Thread3';</DIV>
<DIV> </DIV>
<DIV>
FThread4.Process(</DIV>
<DIV>
procedure()</DIV>
<DIV>
var</DIV>
<DIV>
ANewText4 : String;</DIV>
<DIV> </DIV>
<DIV>
begin</DIV>
<DIV>
Sleep( 500 ); // Simulate thread busy doing time consuming task</DIV>
<DIV>
ANewText4 := ANewText3 + ' + Thread4';</DIV>
<DIV> </DIV>
<DIV>
MainThreadExecute(</DIV>
<DIV>
False</DIV>
<DIV>
,</DIV>
<DIV>
procedure()</DIV>
<DIV>
begin</DIV>
<DIV>
Memo1.Lines.Add( 'Ended Processing: ' + ACounter.ToString() + ' - Result:'
);</DIV>
<DIV>
Memo1.Lines.Add( ANewText4 );</DIV>
<DIV>
Memo1.Lines.Add( '' );</DIV>
<DIV>
Dec( FInProccessingCount );</DIV>
<DIV>
Label1.Caption := 'In processing pipeline = ' +
FInProccessingCount.ToString();</DIV>
<DIV>
end</DIV>
<DIV>
);</DIV>
<DIV> </DIV>
<DIV>
end</DIV>
<DIV>
);</DIV>
<DIV>
end</DIV>
<DIV>
);</DIV>
<DIV> </DIV>
<DIV> end</DIV>
<DIV> );</DIV>
<DIV> </DIV>
<DIV> end</DIV>
<DIV> );</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>This is a 4 stage pipeline with asynchronous main thread printing.</DIV>
<DIV>I dare somebody to implement it in less than 5-6 times more code with
traditional methods, and while matching the performance...</DIV>
<DIV> </DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial'; COLOR: #000000">With best
regards,<BR>Boian
Mitov<BR><BR>-------------------------------------------------------<BR>Mitov
Software<BR>www.mitov.com<BR>-------------------------------------------------------</DIV>
<DIV
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'>
<DIV style="FONT: 10pt tahoma">
<DIV> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=skalogryz.lists@gmail.com
href="mailto:skalogryz.lists@gmail.com">Dmitry Boyarintsev</A> </DIV>
<DIV><B>Sent:</B> Saturday, September 20, 2014 7:46 PM</DIV>
<DIV><B>To:</B> <A title=fpc-devel@lists.freepascal.org
href="mailto:fpc-devel@lists.freepascal.org">FPC developers' list</A> </DIV>
<DIV><B>Subject:</B> Re: [fpc-devel] Suggestion: reference counted
objects</DIV></DIV></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV></DIV>
<DIV
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'>
<DIV dir=ltr>
<DIV class=gmail_extra>To be more accurate.. </DIV>
<DIV class=gmail_extra>You're talking about "closures". The difference between
closures and anonymous functions is explained here: <A
href="http://en.wikipedia.org/wiki/Closure_(computer_programming)#History_and_etymology">http://en.wikipedia.org/wiki/Closure_(computer_programming)#History_and_etymology</A>
the second paragraph. </DIV>
<DIV class=gmail_extra><FONT size=2 face=Arial></FONT> </DIV>
<DIV class=gmail_extra>thanks,</DIV>
<DIV class=gmail_extra>Dmitry</DIV>
<DIV class=gmail_extra><FONT size=2 face=Arial></FONT> </DIV>
<DIV class=gmail_extra><FONT size=2 face=Arial></FONT> </DIV></DIV>
<P>
<HR>
_______________________________________________<BR>fpc-devel maillist
-
fpc-devel@lists.freepascal.org<BR>http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel<BR></DIV></DIV></DIV></BODY></HTML>