[fpc-pascal] [fpc-devel] Nested function closures
Ryan Joseph
genericptr at gmail.com
Tue Apr 27 18:52:28 CEST 2021
> On Apr 27, 2021, at 9:58 AM, Michael Van Canneyt <michael at freepascal.org> wrote:
>
> Wait.
>
> I asked Sven to make sure that nested functions are under ALL circumstances
> usable as closures or can be used instead of anonymous functions.
>
> Pas2js already supports this, and I want FPC and Pas2JS to be compatible in
> this regard.
>
> So as Sven wrote, you would be duplicating effort, needlessly, since it has
> to work always... If the compiler can decide that the heap interface is not
> needed and optimize it away: so much the better. But I doubt this will be
> possible.
Maybe we're misunderstanding each other then. I'm responding to Sven when he says:
> Getting rid of the interface only works in very narrow circumstances that are so seldom in real world code that it is not worth the effort.
I.e. all closures will be interface based because there are not enough real world use cases to support any alternative. Which is contrary to what you're saying that nested functions/closure will be compatible types. Sven can clear this up for us I guess.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list