> On Apr 29, 2021, at 12:01 AM, Sven Barth <pascaldra...@googlemail.com> wrote: > > To be precise there are two more: function/procedure variables (no special > designator) and method variables ("of object"). Depending on what a anonymous > function captures (or for the sake of it a nested function) it would be > possible to assign it to such a type as well (for a function variable only > global variables may be used, for a method variable additionally Self may be > used).
As I remember the capturing code for nested functions and the new closures are not shared. That means when the parser encounters an anonymous function it needs to decide which type of capture it will use, right? In that case the user may need to state that the anon function is "nested" otherwise it will use the wrong capturing method. > > So once the current work is done we have 2 kinds of closures but only one of > those is compatible with anonymous functions and this is why I want the other > closures (nested functions) to have the same pair of functionality. > > Once anonymous functions are supported we can improve their compatibility > with other constructs. > Great, that's what I wanted to do. It's well worth the time to get anon functions for callbacks that return immediately, list.ForEach, list.Sort etc.... Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal