[Dwarf-discuss] Proposal: Add support for "property" with getter/setter (based on Pascal properties)

Augusto Noronha anoronha@apple.com
Mon Oct 7 20:40:09 GMT 2024


> FreePascal and Delphi have RTTI, which allows accessing data. One use case is streaming of a class (well the published part of it).

> This is for example used for GUI apps where the properties of a designed GUI (form, buttons, ..) are streamed so the runtime can load them. But also ORM libs make use of it, or REST.

> For classes there is a "published" section (public + RTTI).
> It can contain fields and properties.
> And any code, without knowledge of the class, can read those fields.

> In some scenarios it is not needed to stream properties if they have there default value. So the streaming code needs to access that.

> property Foo: integer read GetFoo write SetFoo stored ShouldStoreFoo default 123;

> default takes a value (and exists only for certain data types like integer properties. It is stored in the RTTI.

> Stored can be a function or field (or constant) of boolean type. The RTTI also has a link to it, so the streaming code can call it.

> Stored = true => the property should be stored in the stream
> Stored = false -> the property should not be stored

Thanks for the clarification Martin. 

Streaming as a language construct (and controlling whether a property should be streamable or not) seems like a pretty Pascal specific feature, maybe this could be a Pascal extension?


> On Oct 7, 2024, at 2:23 AM, Martin via Dwarf-discuss <dwarf-discuss@lists.dwarfstd.org> wrote:
> 
> On 04/10/2024 21:56, Augusto Noronha via Dwarf-discuss wrote:
>> Hi Martin,
>> Could you explain what a Pascal-style stored accessor is or link to a reference to it? I tried looking it up but couldn’t find anything relevant.
> 
> https://www.freepascal.org/docs-html/ref/refsu38.html
> 
> -- 
> Dwarf-discuss mailing list
> Dwarf-discuss@lists.dwarfstd.org
> https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss



More information about the Dwarf-discuss mailing list