Am 27.04.2021 um 21:19 schrieb Ryan Joseph via fpc-devel:
On Apr 27, 2021, at 12:10 PM, Sven Barth via fpc-devel
<fpc-devel@lists.freepascal.org> wrote:
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.
In nearly all cases the interface can't be optimized away.
So as you showed it's not as bad as I thought, which is good, however my point was that
in my scenario, which I argue is indeed very common, it could be implemented as a
"nested anonymous function". My reasons:
1) Nested functions already exist and merely need an anonymous parser to be
implemented (as I already did in that branch).
2) The interface is literally 100% useless as the object is never passed
outside of the receiver (SortEntities). It will be created and destroyed with
absolutely no value to the program whatsoever.
The "is nested" in your other mail was the important part that was
missing. How about providing *complete* examples in the future?
Anyway, it would in principle be possible to convert an anonymous
function to a "is nested" function, but that will only come *after* the
whole implementation is here so that the chance for messing that core
functionality (!) up is reduced.
Regards,
Sven
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel