Hi,

thanks Sven, finally we have initial RTTI.pas version on trunk. Let me
start with first serious issue and eventually patch:

function IsManaged(TypeInfo: PTypeInfo): boolean;

IsManaged can't work with records because we need know managed fields count
(in Delphi when ManagedFldCount is bigger than 0 it means that record has
managed fields and problem is solved). Two possible (and IMO correct)
solutions:

1. I think it's time to new position in "User Changes" wiki page. We can
fix that by new behavior (a more Delphi compatible, more logical, more
proper and a little incompatible with old code, but the risk is minimal):
ManagedFldCount should be fixed/corrected as mentioned in
http://bugs.freepascal.org/view.php?id=29767 (so it should count *real*
managed field as the name "ManagedFldCount" suggests. Otherwise we can't
implement this function. Btw. old behavior for ManagedFldCount will be not
usefully anymore with RTTI module/improved TypInfo for counting all fields.

2. http://bugs.freepascal.org/view.php?id=30687#c96093 PART 2 of reworked
patch for Management Operators should be accepted. With this path we have
access to Init RTTI table. Anyway solution 1 is strongly recommended.

Other "solutions" (IMO totally wrong):

3. New compiler intrinsic routine:

function IsManagedType(T: Type): Boolean;

which is no real alternative because IsManaged from RTTI.pas is more
run-time dedicated and is impossible to replace IsManaged by IsManagedType
for all scenarios. Generally new intrinsic IsManagedType is not wrong but
in our context is useless...

 4. New additional RTTI generated for records, for example new field for
TTypeData:

ThisIsRealAndNotFakeManagedFldCount: Integer;

with additional list declared after ManagedFields:
array[1..ManagedFldCount] of TManagedField:

ThisIsRealAndNotFakeManagedFields:
array[1..ThisIsRealAndNotFakeManagedFldCount] of TRealAndNotFakeManagedField

Or some flag in TTypeData for records:

YesIamManagedRecordAndIHaveRealManagedFieldsAndYesPleaseIgnoreManagedFldCountWhichIsLying:
boolean;

-- 
Best regards,
Maciej Izak
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to