Since version 2009, the Delphi language (or better, its Object Pascal dialect) supports anonymous methods. What's an anonymous method? Not surprisingly, an anonymous method is a procedure or a function that does not have an associated name. An anonymous method treats a block of code just like a value so that it can be assigned to a variable, used as a parameter to a method, or returned by a function as its result value. In addition, an anonymous method can refer to variables and bind values to them in the context scope in which the anonymous method is defined. Anonymous methods are similar to closures defined in other languages, such as JavaScript or C#. An anonymous method type is declared as a reference to a function:
type TFuncOfString = reference to function(S: String): String;
Anonymous methods (or...