On 18.04.2016 10:18, Jonas Maebe wrote:
Delphi does not support assigning procedures to variables representing anonymous functions

It does. Both for procedure of object and plain procedure:

program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils;

type
  TRefProc = reference to procedure;

  TMyObj = class(TObject)
  public
    procedure Test2;
  end;

  procedure Test;
  begin
    Writeln('hello');
    Readln;
  end;

{ TMyObj }

procedure TMyObj.Test2;
begin
  Writeln('hello2');
  Readln;
end;

var
  xR: TRefProc;
  xO: TMyObj;
begin
  xR := Test;
  xR();

  xR := xO.Test2;
  xR();
end.

Ondrej
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to