Re: [fpc-pascal] RTTI and generics: accessing specialized class instance

2015-10-31 Thread leledumbo
> You'll have the problem to know the specific class at compile time no matter whether you use generics or inheritance Not really, with inheritance, I can just cast the TObject returned by GetObjectProp to the parent class (TGenClass). Because that's all I need: accessing TGenClass members. > If

Re: [fpc-pascal] RTTI and generics: accessing specialized class instance

2015-10-31 Thread Sven Barth
Am 31.10.2015 05:31 schrieb "leledumbo" : > > > TGenClass<> is not a full type, only TGenClass is, so you need to > use - in your example - TSpecType(Obj) > > Yes, I'm aware of this. The problem is I don't know TSpecType which I said > the last note. It could be any user defined specialization of T

Re: [fpc-pascal] RTTI and generics: accessing specialized class instance

2015-10-30 Thread leledumbo
> TGenClass<> is not a full type, only TGenClass is, so you need to use - in your example - TSpecType(Obj) Yes, I'm aware of this. The problem is I don't know TSpecType which I said the last note. It could be any user defined specialization of TGenClass. Back to above code, but closer to my actual

Re: [fpc-pascal] RTTI and generics: accessing specialized class instance

2015-10-30 Thread Sven Barth
On 30.10.2015 20:10, leledumbo wrote: Consider the following: type generic TGenClass = class ... end; TSpecType = specialize TGenClass; TMyClass = class FST: TSpecType; procedure p; published ST: TSpecType read FST write FST; end; procedure TMyClass.p; ...

[fpc-pascal] RTTI and generics: accessing specialized class instance

2015-10-30 Thread leledumbo
Consider the following: type generic TGenClass = class ... end; TSpecType = specialize TGenClass; TMyClass = class FST: TSpecType; procedure p; published ST: TSpecType read FST write FST; end; procedure TMyClass.p; ... begin PropCount := GetPropList(Self,Props); fo