[fpc-devel] Published record

Michael Van Canneyt michael at freepascal.org
Fri Aug 16 08:30:22 CEST 2024



On Thu, 15 Aug 2024, Mattias Gaertner via fpc-devel wrote:

> Hi,
>
> What is the state of published record in fpc trunk?

You cannot publish records, and this is not planned.

This is because things like

MyClass.MyRecord.MyField:=12;

do not work as one would naively expect. It does work if you use a TPersistent
instead of a record (the very reason the TPersistent class was invented)

However, you can use extended RTTI to access this typeinfo and manipulate the record. 
That works.

Michael.


More information about the fpc-devel mailing list