This is a copy of a post on the macpascal mailing list, where it was suggested to re-ask on the fpc-devel list.

-----

The RTTI generating logic in the FPC compiler puzzles me ....

Chapter 40 of FreePascal Run-Time Library Reference guide describes the typinfo 
unit. It says

; The TypeInfo unit contains many routines which can be used for the querying 
of the Run-Time
; Type Information (RTTI) which is generated by the compiler for classes that 
are compiled under the
; {$M+} switch

Great so far !

; This information can be used to retrieve or set property values for published 
properties
; for totally unknown classes. In particular, it can be used to stream classes

This is what I fail to understand. Why is RTTI information tied to properties 
and why is it
restricted to what is in the published/public sections of classes (or objects 
in macpas mode) ? For
example, when I want to implement an object browser for debugging purposes, I 
want to see anything.
What I am allowed in the code to do with the methods and fields is irrelevant 
and whether fields
are properties or not is irrelevant too.

When I try it, $M+ refuses public non-property class fields. With $M- 
ClassInfo, GetTypeData and
the ParentInfo field work. However, FieldAddress and MethodName do not work. 
The field count in the
FieldTable field of the VMT is 0.

Is there a special reason why the compiler can't fill in the VMT's FieldTable ?

-----

Jonas Maebe replied that RTTI information has been implemented according to Delphi conventions. Marco van de Voort mentioned D2010 and work being done on the extended RTTI ($RTTI directive). Paul Ishenin remembered Joost implemented some prototype in a branch, that had some problems and was not merged to trunk yet.

Regards,

Adriaan van Os

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to