[fpc-pascal] Caller agnostic procedure variables

Ryan Joseph genericptr at gmail.com
Tue Feb 15 13:14:33 CET 2022



> On Feb 15, 2022, at 5:15 PM, Sven Barth <pascaldragon at googlemail.com> wrote:
> 
> It contains a capture object that backs the method. 
> If nothing is captured and the right hand side is a direct function or method pointer then the compiler could in principle create something that is essentially static to avoid allocations, but that would be a future optimization. 
> 

So if we do this there is nothing being captured right? In that case we get an interface which can call a function pointer? Does the interface then know about "of object" and "is nested" types at all or does it use a totally different mechanism to call those?

================

type
 TMyAction = reference to procedure;

procedure MyAction;
 begin
 end;

procedure Test;
 begin
   DoThis(@MyAction);
 end;

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list