[fpc-pascal] Why does nested function get corrupted?

Ondrej Pokorny lazarus at kluug.net
Sun Sep 11 15:29:15 CEST 2022


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.

Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20220911/5434ceed/attachment.htm>


More information about the fpc-pascal mailing list