<p>Am 22.09.2014 17:11 schrieb "Jonas Maebe" <<a href="mailto:jonas.maebe@elis.ugent.be">jonas.maebe@elis.ugent.be</a>>:<br>
><br>
><br>
> On 22 Sep 2014, at 16:44, Peter Popov wrote:<br>
><br>
>> Another comment: If referenced objects all derive from a single base, then, the user cannot possibly have another hierarchy, which uses ref. objects. As I mentioned earlier, I do this explicitly for an object well down my hierarchy. So, it seems to me you still need something like:<br>
>><br>
>> -- code --<br>
>><br>
>><br>
>> TRefObject = referenced class(TWhateverBase)<br>
>> end;<br>
><br>
><br>
> I would strongly recommend against that. Referenced and unreferenced objects are completely different beasts with different behaviours. If you allow that, you get all kinds of problems down the line. E.g. you either have to forbid assigning a TRefObject to a TWhateverBase (which runs counter to a very basic OOP principle), or allow it and then have the programmer deal with the resulting reference counting mess-ups.</p>
<p>As written in my RFC I would go the "allow it" route and provide mechanisms to manually access the reference count from a non-reference counted variable (thus being implemented in TObject). Optionally one could add a warning that is off by default that one could use for such cases. This approach is necessary, because we'd otherwise need to introduce overloads for e.g. RTTI functionality in TypInfo or to introduce some compiler magic for them (I don't like either of these two possibilities).</p>
<p>Regards,<br>
Sven</p>