> 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. Regards, Ryan Joseph _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel