> On Sep 17, 2022, at 10:51 PM, Sven Barth <pascaldra...@googlemail.com> wrote:
> 
> Complain to the developers of Delphi then.
> 
> I do however plan to extend anonymous (and nested) functions with a syntax 
> that allows to select whether a variable should be by-reference or by-value. 
> But that's still a bit off, cause I have other things to do first.

Yes that’s a very good idea and gives us more control (C++ and Swift allow 
explicit capture groups for example). In this example though would it even 
matter? The idea of capturing a loop iterator before the loops runs doesn't 
make sense to me. Maybe it should even be illegal or give a warning since it’s 
so error prone.

Speaking of that the Extended RTTI branch I did is over a year old I think now. 
Probably no chance of merging that without serious work. Michael got the RTL 
stuff done and tested everything but I’ve nearly forgotten about it since and I 
don’t know where it really stands. Hopefully that can be merged before it gets 
even more stale and decrepit. :)

> 
>> 
>>> And they are not pointers, but the variable is moved to an object instance 
>>> which implements the interface of the function reference.
>> “Moved to an object” makes me think the variable is copied but the reference 
>> behavior you describe sounds like a pointer so I’m still not 100% clear on 
>> what you mean.
> 
> Let's take your initial example and adjust it so that i will really be 
> captured:

Yeah I get this now. I was just being dumb with threads. The capturing isn’t 
even the most of my problems here.

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