delphilambdaclosuresanonymous-methodsfreepascal

How can I use anonymous methods in Free Pascal?


I tried to use Delphi's syntax for anonymous methods:

type
    fun = reference to function(): Integer;

Fpc shows a syntax error:

Error: Identifier not found "reference"

What's the Free Pascal equivalent to Delphi's anonymous methods, if any?


Solution

  • Anonymous methods are not implemented in FreePascal. The list of such features is here.