Re: [fpc-pascal] Function reference doesn't capture in thread

2022-09-17 Thread Hairy Pixels via fpc-pascal
> On Sep 17, 2022, at 10:51 PM, Sven Barth 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

Re: [fpc-pascal] Get TMethod from function reference

2022-09-17 Thread Hairy Pixels via fpc-pascal
> On Sep 17, 2022, at 10:57 PM, Sven Barth wrote: > > === code begin === > > type > TProc = reference to procedure; > TMyClass = class > procedure DoThis; > end; > > TCapturer = class(TInterfacedObject, TProc) > m: procedure of object; > procedure Anonymous1; > > proc

Re: [fpc-pascal] Get TMethod from function reference

2022-09-17 Thread Sven Barth via fpc-pascal
Am 16.09.2022 um 03:53 schrieb Hairy Pixels: On Sep 11, 2022, at 3:28 PM, Ondrej Pokorny via fpc-pascal wrote: You should be able to get the Invoke procedure pointer from the RTTI. Sorry Sven mentioned this I must have glossed over it. So yes I am storing the function reference in a class

Re: [fpc-pascal] Function reference doesn't capture in thread

2022-09-17 Thread Sven Barth via fpc-pascal
Am 17.09.2022 um 17:04 schrieb Hairy Pixels: On Sep 17, 2022, at 9:43 PM, Sven Barth wrote: Then you didn't read my announcement mail deeply enough, cause it's mentioned there! Yes I just read that over and I remember it now. I feel like this not the same behavior in other languages althou

Re: [fpc-pascal] Function reference doesn't capture in thread

2022-09-17 Thread Hairy Pixels via fpc-pascal
> On Sep 17, 2022, at 9:43 PM, Sven Barth wrote: > > Then you didn't read my announcement mail deeply enough, cause it's mentioned > there! Yes I just read that over and I remember it now. I feel like this not the same behavior in other languages although I’d need to test. Most recently I’m

Re: [fpc-pascal] Function reference doesn't capture in thread

2022-09-17 Thread Sven Barth via fpc-pascal
Hairy Pixels schrieb am Sa., 17. Sep. 2022, 16:38: > > > > On Sep 17, 2022, at 7:40 PM, Sven Barth > wrote: > > > > It seems you haven't read the part about capturing variables in my > announcement mail, cause you have two problems: > > First the specific problem your code has: i is a global var

Re: [fpc-pascal] Function reference doesn't capture in thread

2022-09-17 Thread Hairy Pixels via fpc-pascal
> On Sep 17, 2022, at 7:40 PM, Sven Barth wrote: > > It seems you haven't read the part about capturing variables in my > announcement mail, cause you have two problems: > First the specific problem your code has: i is a global variables and global > variables are *never* captured, because th

Re: [fpc-pascal] Function reference doesn't capture in thread

2022-09-17 Thread Sven Barth via fpc-pascal
Am 17.09.2022 um 07:02 schrieb Hairy Pixels via fpc-pascal: Can anyone explain why this program doesn’t capture the state of the local variable “I” and execute in order? It will return something like this: Invoked: 3 id: 0001029D41C0 Invoked: 0 id: 0001029D42C0 Invoked: 0 id: 000102