[fpc-devel] Delphi anonymous methods

Martin lazarus at mfriebe.de
Mon Mar 4 12:35:18 CET 2013


On 04/03/2013 06:06, Boian Mitov wrote:
> It may be a good idea to analyze the current Delphi implementation.
> In essence the anonymous method expands to a class and interface.
> The interface Execute method has the parameters of the anonymous 
> function. and the corresponding interface has the Execute method.
> The class contains all the variables that are captured from the 
> current context, and the constructor of the class does the capture.
> The class is reference counted trough the interface, and is disposed 
> when all references are released.
> There are some interesting side effects and benefits from the 
> implementation, and there are fear number of articles about that on 
> the web.

All fine and good. But all that can be done with a *named* closure too



More information about the fpc-devel mailing list