> On Nov 3, 2023, at 2:08 PM, Sven Barth <pascaldra...@googlemail.com> wrote:
> 
> By default the purpose of anonymous functions assigned to function references 
> *is* that they can escape their scope. This will not change, because they 
> were after all introduced for Delphi-compatibility and there won't be any 
> designations that the value can't escape. If the compiler can't figure it out 
> by its own (see above) then tough luck; use a feature better suited for that. 
> 

Ok I misinterpreted what you previously said then.

I think Swift does this because they only have a single function pointer type 
which serves all purposes while FPC has 4 distinct types.

IMO FPC needs this also since it's not possible for libraries to know which 
kind of function the caller may provide. Behind the scenes the different types 
are required (global, nested, method, reference) but there should be a way to 
unify these into single type. How to store the capturer and manage its memory 
would be an open question though.


Regards,
Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to