[fpc-devel] RTTI unit

Dimitri Smits smitco at telenet.be
Sun Aug 29 15:32:31 CEST 2010


Michael, thank you for the reply. It makes a few things a lot clearer for me. I'll comment a bit more below.

----- "Michael Van Canneyt" <michael at freepascal.org> schreef:

> On Sat, 28 Aug 2010, Dimitri Smits wrote:
> > What I want to do:
> > Since Delphi 2010, there is a new unit in the RTL that makes RTTI
> more of
> > a breeze.  I'd like to port (meaning: compatible interface, fpc
> > implementation) this unit to fpc-rtl.  Initially port over what is
> there
> > already.  Later maybe include in the compiler stuff like scoped RTTI
> (not
> > just published alone) and "customattributes" if there is need for
> that
> > level of compatibility.  Also, adding more methods on the current
> > interface is possible too.  It is more than just a readable
> substitute for
> > TypInfo.
> 
> Well, the compiler doesn't support custom attributes.

I know, neither does it support RTTI-scoping (only published members of a class, and other types are 'public') or run-time unit per package registration or ...

Like I said: first implement what is there and can be ported to fpc. That way I do not have to dive into compiler-output and parsing (for now). Later on, it can be expanded with those features that DO get implemented or not if they'll never be.
After initial porting, I might extend the interfaces with a few methods (e.g.: getters+setters with AsString+AsInteger+As... etc).

But first: port what is there.

> 
> >
> > For this I'd like to know a few things:
> > - First off: would this kind of thing even be considered for
> inclusion?
> 
> Yes. Any unit to increase Delphi compatibility is worth of inclusion.

good to know. to be placed next to types unit in objpas, I presume.
 
> > - How to get it into repository/feedback from core? (through feature
> request with attachment in mantis?)
> 
> I'll handle that; Just post it on mantis, I'll look into it.

attach the unit, or in patch form?

> > - Codestyle conventions for fpc-code? (including licence-header
> etc)
> 
> Modified LGPL header (see any rtl file).
> Code style: follow the Borland style guide.

that header, with your name & Florian or mine or 3? :-)

> 
> > - Is there (besides System, SysUtils, Types and the Variant-units)
> another place to look for RTTI-types?
> 
> Not sure I know what you mean by this ?

Is there another unit other than those that contains structures & defs mapping to what the compiler generates? (like ptypeinfo, but also for punittype, or packages)

anything I've missed regarding lowlevel info on types & language constructs

> 
> > - Where do I need to take care off (how to include it in rtl
> package, ..., unit-dependencies )?
> 
> Nothing. I'll take care of that, you just write the code.
> 

what i meant was: don't use generic types like fpglist and/or consorts that are not in the rtl package. (what files can I check to see what is included in the rtl so I don't accidentally make cyclic dependencies.

> > - I've read somewhere that nothing gets included if no unit-tests
> are
> > - provided.  Is this using fpcunit?  Any pointers on the
> testingsystem,
> > - do's and don'ts are welcome.
> 
> You can use fpcunit; there are sample tests in the fcl-fpcunit
> directory.
> 

to be placed under what dir? fpcunit would have been my choice nevertheless. :-)

> All other daily test programs use a different mechanism: they must
> return 
> a zero exit code. Nonzero exit code means that there is an error.
> 
> You're free to choose one over the other; Personally, I favour
> fpc-unit style.
> I find it works most easily, definitely if you use Lazarus.
>

so, lpi files and the like are acceptable in fpc?
 
> > Since I work on win32 (only), I'm not that familiar with makefiles.
> So, if
> > I need to add anything to makefiles or copy+edit another makefile,
> please
> > redirect me to more information.  (mainly for testing-app, I guess)
> 
> Let me handle that. Focus on the code.
> 

will do. Have to start, and probably will go through a few iterations before I post it in mantis (also, when time permits). And even then it might be something to discuss first and take a few posts to get it "feature complete".

if that's allright by you ;-)

kind regards,
Dimitri Smits



More information about the fpc-devel mailing list