[fpc-pascal] Caller agnostic procedure variables
Ryan Joseph
genericptr at gmail.com
Tue Feb 15 15:02:13 CET 2022
> On Feb 15, 2022, at 8:32 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>
> A function reference is simply an interface of which the Invoke method can be called on the instance instead of manually doing "Foo.Invoke".
>
> The real "magic" is when the compiler generates the *implementation* of said interface. So in the end what can be assigned to a function reference depends on the compiler being able to generate suitable implementations.
So when you assign a global function to a function reference it has to generate a new function body? I guess that makes sense on how it can "capture" these different types of functions.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list