Ryan Joseph via fpc-pascal
2021-04-27 16:52:28 UTC
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.
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.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.
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.
Regards,
Ryan Joseph
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/