[fpc-pascal] Caller agnostic procedure variables
Ryan Joseph
genericptr at gmail.com
Wed Feb 16 03:10:31 CET 2022
> On Feb 16, 2022, at 2:46 AM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>
> // nested function/procedure/routine variable
> type
> TFoobarNested = function: LongInt is nested;
>
> var
> f: TFoobarFuncRef;
> begin
> // anonymous function/procedure/routine
> f := function: LongInt
> begin
> end;
> end;
"However assigning a nested function variable to a function reference is much harder.
Assigning a function reference to a nested function variable is hard as well. "
This means if you expanded your example with:
var
n: TFoobarNested;
begin
f := n;
THAT would be hard? I've never passed around nested function vars before so I don't really know the limitations of this. The important thing is the primary use case works.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list