Hi Sven, Could you please give a simple example that shows what you said: require that the type with which you specialize is a record. Then a class operator in that record can be defined.
Thanks 2013/2/26 Sven Barth <[email protected]> > Am 26.02.2013 08:59 schrieb "xrfang" <[email protected]>: > > >> > >> No, it's not a dilemma, but rather a requirement. Before generics > >> specialization, all required operations for given type must be known. > This > >> is because the symbol table when the generics is parsed must be > >> reconstructed when it gets specialized. Think about declaring usual > classes > >> with the generic parameter replaced with actual type. If at that time, > the > >> operation < is not yet defined, the code won't compile anyway. > > > > > > It is a pity. I think if fpc supports class operators, maybe this > problem could be solved by using class helpers (my purpose is that users of > ttreap class does not have to modify treap.pas) ? Is that possible in > future FPC? > > Helpers have the same problem. For now there is only one solution (as I > already wrote): require that the type with which you specialize is a > record. Then a class operator in that record can be defined. > > For the future I already have the following longterm plans: > - add class operator support to class and object > - allow to specify additional units after "specialize" that will be used > when specializing (they will be added first, so that the original code is > not unnecessarily modified) > > Regards, > Sven > > -- > _______________________________________________ > Lazarus mailing list > [email protected] > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > >
-- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
