[fpc-pascal] Caller agnostic procedure variables
Ryan Joseph
genericptr at gmail.com
Tue Feb 15 08:27:11 CET 2022
> On Feb 15, 2022, at 2:09 PM, Michael Van Canneyt via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>
> I've answered this question before:
>
> The "Reference to procedure" that will be part of anonymous functionswill do this for you.
I'm sorry I forgot! This thing keeps coming up for me and driving me nuts but I knew I asked in passing before.
So "reference to procedure" are going to be the new standard? To extend my example it would look like this? I please remind me, is there a closure involved which is capturing state and adding overhead?
I'm curious what this type actually is also, maybe a dispatch table which wraps the existing types or is it something totally new?
====================
type
TMyAction = reference to procedure;
procedure DoThis(action: TMyAction);
begin
action();
end;
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list