<p>Am 26.02.2013 08:59 schrieb "xrfang" <<a href="mailto:xrfang@gmail.com">xrfang@gmail.com</a>>:<br>
>><br>
>> No, it's not a dilemma, but rather a requirement. Before generics <br>
>> specialization, all required operations for given type must be known. This <br>
>> is because the symbol table when the generics is parsed must be <br>
>> reconstructed when it gets specialized. Think about declaring usual classes <br>
>> with the generic parameter replaced with actual type. If at that time, the <br>
>> operation < is not yet defined, the code won't compile anyway.<br>
><br>
><br>
> 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?</p>
<p>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.</p>
<p>For the future I already have the following longterm plans:<br>
- add class operator support to class and object<br>
- 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)</p>
<p>Regards,<br>
Sven</p>