A function reference can call a class method but can you get the TMethod data 
from function references? It was possible with “is object” to cast to TMethod 
but that doesn’t seem to be possible with references.

=========

type
  TMyClass = class
    constructor Create;
    procedure DoThis;
  end;

  constructor TMyClass.Create;
  var
    proc: reference to procedure;
  begin
    proc := @DoThis;
    writeln(Assigned(PMethod(proc)^.data)); // FALSE
  end;


Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to