Ryan Joseph via fpc-pascal <fpc-pascal@lists.freepascal.org> schrieb am Di., 15. Feb. 2022, 15:02:
> > > > On Feb 15, 2022, at 8:32 PM, Sven Barth via fpc-pascal < > fpc-pascal@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. > For a global function the compiler has to generate a wrapper that gets rid of the Self parameter of the interface. Regards, Sven >
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal