Hi Sven,<br><br>Could you please give a simple example that shows what you said:  <span style="color:rgb(255,0,0)">require that the type with which you specialize is a record. Then a class operator in that record can be defined.</span><br>

<br>Thanks<br><br><div class="gmail_quote">2013/2/26 Sven Barth <span dir="ltr"><<a href="mailto:pascaldragon@googlemail.com" target="_blank">pascaldragon@googlemail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<p>Am <a href="tel:26.02.2013%2008" value="+12602201308" target="_blank">26.02.2013 08</a>:59 schrieb "xrfang" <<a href="mailto:xrfang@gmail.com" target="_blank">xrfang@gmail.com</a>>:</p><div><div class="h5">

<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?</div>

</div><p></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>
<br>--<br>
_______________________________________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a><br>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
<br></blockquote></div><br>