[fpc-devel] RTTI and Attributes in Delphi 2010

Marco van de Voort marcov at stack.nl
Sun Aug 16 12:26:55 CEST 2009

In our previous episode, Paul Ishenin said:
> > I never understood the need for it. RTTI is more than enough
> > for 99.99% of the cases.
> Imagine you have a db framework which maps delphi classes to database 
> tables. It reads class properties from the rtti and creates db tables 
> automatically.
> For example:
> TStudent = class(TPersistent)
> published
>   property ID: Integer read FID write FID;
>   property Name: String read FName write FName;
>   property Age: Integer read FAge write FAge;
>   property Group: String read FGroup write FGroup;
> end;
> How db framework can create a table based on this information? It needs 
> some more info about field types, primary keys.

I know what .NET uses it for, but that was not the question.

The question is why does this have to be solved using a language construct?
Why can't you simply register the Object-Relation mapping somewhere else?

What is the value of making it RTTI? Sure you can abuse RTTI to hang
information on any identifier, and make a nice example out of it, but does
that really display the requirement for RTTI?

More information about the fpc-devel mailing list