On 29.09.2013 05:30, Xiangrong Fang wrote:
type generic TTree<T> = class ... ... end; TTreeType = class of TTree;
This is illegal code and compiled by pre-2.7.1 FPC only because of bugs in the generic implementation. "TTree" is not a legal type outside of the generic's declaration or implementation (and no, TTree<T> is neither).
1) is it possible to define class helper for generic classes?
No. I recently had the thought to allow this as well, but not now.
2) why class helper require a class and we cannot use a class reference?
A class helper always work on variables (or return values) of the type you specified. So if you'd be able to define a class helper for TTreeType you'd only be able to use it on variables of type TTreeType or e.g. TTreeType(Self.ClassType), but not on instances of TTree<>.
Regards, Sven _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal