[fpc-devel] Class helper: small differences between FPC and Delphi

Sven Barth pascaldragon at googlemail.com
Sat Mar 26 22:09:21 CET 2011


On 26.03.2011 14:44, Florian Klaempfl wrote:
> Am 25.03.2011 22:33, schrieb Sven Barth:
>>
>> 2. In Delphi helpers are based on classes and in FPC they are a seperate
>> type. I've choosen the later, because it has reduced the need for some
>> checks and also simplified the code.
>> I noticed the difference when checking the RTTI parent reference of a
>> class helper (I had already checked that it is of type tkClass, but
>> haven't thought more about it): the result was that all helpers (class
>> and record) inherit from a class TClassHelperBase which in turn inherits
>> from TInterfacedObject.
>
> What does prevent you to mimic this behaviour?

I hope you mean to only mimic this exact RTTI case...

I'd need to add a Delphi compatible "TClassHelperBase" class in 
system.pp and track its def like its done for "TObject", "IUnknown" and 
teh ObjC base def.

* technical prevention: none
* personal prevention: I'm personally not a big fan of those "compiler 
tracked defs" (although I already know that I need to add one when I'm 
going to implement attributes :( )

If you think it would be wiser to mimic the Delphi implementation, I 
will do so.
In my opinion though the difference should not concern too many people 
(*) and would lead to a cleaner way to decide whether a given type is a 
helper or a real class. Also I'd be able to add a "ExtendedTypeInfo" 
field which would contain the type the helper extends.

(*) a quick google search basically only revails Embarcadero's thin 
documentation about that class ( 
http://docwiki.embarcadero.com/VCL/2010/en/System.TClassHelperBase ) and 
the class helper threads on this mailing list

Regards,
Sven



More information about the fpc-devel mailing list