[fpc-pascal] Why does nested function get corrupted?
Sven Barth
pascaldragon at googlemail.com
Sun Sep 11 21:22:05 CEST 2022
Ondrej Pokorny via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
So., 11. Sep. 2022, 15:29:
> Am 11.09.2022 um 14:22 schrieb Sven Barth via fpc-pascal:
>
> Ondrej Pokorny via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb
> am So., 11. Sep. 2022, 12:18:
>
>> Shouldn't this assignment be forbidden?
>>
>> type
>> TProc = procedure is nested;
>> function TestNested: TProc;
>> begin
>> result := procedure // why is this possible?
>> begin
>> writeln(data);
>> end;
>>
>> It is not a nested function but an anonymous one.
>>
>>
> And? An anonymous function is assignment compatible to multiple left sides
> depending on what it captures. See my announcement mail.
>
> Thank you Sven - I missed this info in your email.
>
It's an extension I had done compared to Delphi so that anonymous functions
are also usable without function references which are a bit more heavy
weight after all.
Regards,
Sven
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20220911/e13411bb/attachment.htm>
More information about the fpc-pascal
mailing list