Re: [fpc-pascal] Variants with classes and records

2022-10-06 Thread Marco van de Voort via fpc-pascal
On 6-10-2022 14:16, Sven Barth via fpc-pascal wrote: And that crashed also. I thought it would be ok to just hold the reference but not claim ownership over it. Variants count as managed types and they can contain interface references and strings. If you use a custom type you can do

Re: [fpc-pascal] Variants with classes and records

2022-10-06 Thread Sven Barth via fpc-pascal
Hairy Pixels schrieb am Do., 6. Okt. 2022, 13:49: > > > > On Oct 6, 2022, at 12:45 PM, Sven Barth > wrote: > > > > Am 05.10.2022 um 14:16 schrieb Hairy Pixels via fpc-pascal: > >> Is it possible to assign a class to a variant? I tried and get a crash. > If not, why not? It’s just a pointer so I

Re: [fpc-pascal] Variants with classes and records

2022-10-06 Thread Hairy Pixels via fpc-pascal
> On Oct 6, 2022, at 12:45 PM, Sven Barth wrote: > > Am 05.10.2022 um 14:16 schrieb Hairy Pixels via fpc-pascal: >> Is it possible to assign a class to a variant? I tried and get a crash. If >> not, why not? It’s just a pointer so I would expect it to work. > > There is no field that would ho

Re: [fpc-pascal] Variants with classes and records

2022-10-05 Thread Sven Barth via fpc-pascal
Am 05.10.2022 um 14:16 schrieb Hairy Pixels via fpc-pascal: Is it possible to assign a class to a variant? I tried and get a crash. If not, why not? It’s just a pointer so I would expect it to work. There is no field that would hold a class reference and no type value that would differentiate