<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Hairy Pixels <<a href="mailto:genericptr@gmail.com">genericptr@gmail.com</a>> schrieb am Sa., 4. Nov. 2023, 01:42:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
> On Nov 3, 2023, at 8:31 PM, Sven Barth <<a href="mailto:pascaldragon@googlemail.com" target="_blank" rel="noreferrer">pascaldragon@googlemail.com</a>> wrote:<br>
> <br>
> If you need a catch all type, then you should use function references. There is no need to invent yet another type.<br>
> The only thing it can not handle is the assignment of nested function pointers (in contrast to nested functions directly), because they can only ever be used in a function that is below the one where the nested function was assigned which is not a guaranteed property for function references.<br>
> <br>
<br>
not always because it creates a heap allocated interfaces for every function they're used in, even if it doesn't escape the scope. Maybe this was fine for Delphi but they can't be used for anything real time outside of GUI apps.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Then don't assign them every "frame". If you just keep them around then they aren't more expensive than a virtual method call. </div><div dir="auto">And any other mechanism would involve the heap as well, because that's how anonymous functions that capture variables work and thus anything that wants to store them must play by the same rules. There won't be any changes there. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>