[fpc-devel] RTTI generating

Adriaan van Os fpc at microbizz.nl
Mon Sep 22 14:15:24 CEST 2014

Florian Klämpfl wrote:
> Am 19.09.2014 um 22:49 schrieb Boian Mitov:
>> On Fri, 19 Sep 2014, Adriaan van Os wrote:
>> Your remarks seem to imply that you think RTTI can be used to inspect any aspect of an object.
>> It was/is not meant for that.
>> <<<
>> Quite incorrect. All languages with modern RTTI allow for full object inspection, and that includes
>> Delphi 2010 and higher, C#, and even VB has it.
>> The fact is that FPC is just stuck in the last century, and the lack of any even remotely decent
>> RTTI in it makes it unsuitable for any modern development.
> FPC supports what it's users are implementing. No more no less. This is how a community driven OSS
> project works.

Thanks for the various reactions to my post about RTTI in FPC. I will wait to see what will be 
available in the future. To give some background, here is an explanation of what I am trying to 

The Pascal version of MacApp <http://en.wikipedia.org/wiki/MacApp>, which I am maintaining, has an 
object browser. That browser is disabled in the current source base, but it could be restored. The 
browser historically works through the MacApp root object which has

       procedure Fields
         ( procedure DoToField
               (     theFieldName      : Str255;
                     theFieldAddr      : Ptr;
                     theFieldType      : SInt16));

The Fields method must be implemented in every object type that adds fields (not properties, MacApp 
uses MacPas style classes). This scheme works, but adds a lot of code, like this

procedure TEvtHandler.Fields(procedure DoToField(fieldName: Str255; fieldAddr: Ptr; fieldType: 
       DoToField('TEvtHandler', nil, bClass);
       DoToField('fNextHandler', @fNextHandler, bObject);
       DoToField('fIdleFreq', @fIdleFreq, bLongInt);
       DoToField('fLastIdle', @fLastIdle, bLongInt);
       inherited Fields(DoToField);


  So, I started experimenting with the RTTI  to have this automated .....


Adriaan van Os

More information about the fpc-devel mailing list