2016-12-10 0:54 GMT+01:00 Sven Barth <pascaldra...@googlemail.com>:

> We rename ManagedFldCount to TotalFieldCount, add a field
> ManagedFieldCount and a property ManagedFldCount that returns
> TotalFieldCount for backwards compatibility (and maybe marked as
> deprecated).
>

I've created new bug report to express my strong stand about this problem:

http://bugs.freepascal.org/view.php?id=31102
(copied from bug report)

FPC has long standing critical issue. ManagedFldCount field in TypInfo
(TTypeData) contains "count" for all fields (but should contains "count"
for managed fields only - as name suggest). It is not feature but highly
visible bug.

* The bug has critical meaning for development of RTTI.pas because is
impossible to implement in rational way IsManaged function (ManagedFldCount
is used for that)
* The bug has many performance issues  especially for
InitializeArray/FinalizeArray.
* The bug means more Delphi incompatibility RTTI.
* For scripting languages it means many troubles (for Delphi porting code)
* TManagedField entry for each (I mean here unmanaged fields) field has
zero value for programmer, it has no sense.

any partial fix with pseudo backward compatibility has no sens and will
bring much more noise and confusion  and more complicated RTTI code without
real gain.

the proper layout for part related to records (in current state) in
TTypeData is:

      tkRecord: ( // could be extended for info about attributes, methods
and operators (maybe also properties)
        RecSize: Integer;
        ManagedFldCount: Integer;
       {ManagedFields: array[0..ManagedFldCnt - 1] of TManagedField;
        RecFldCnt: Integer;
        RecFields: array[1..RecFldCnt] of TRecordTypeField});

where

  TRecordTypeField = packed record
    Field: TManagedField;
    Flags: Byte; // visibility
    Name: ShortString;
  end;


When we have additional "Name" and "Flag" for managed and unamanaged fields
it has sense, because when we have more info than pure TManagedField for
each field, it could be used for ORM or for scripts. Probably is good idea
to correlate RecFields together with:

{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}

The patch provided in #29767 is wrong when we thinking about extended RTTI
(init table should stay simple as possible), same for MO PART 2 (
http://bugs.freepascal.org/view.php?id=30687#c96093 )

It must be changed same as was needed change for indirect type info
(PPTypeInfo) for greater good.

-- 
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