DIP74: Reference Counted Class Objects

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 26 18:39:12 PST 2015


On 2/26/15 6:21 PM, H. S. Teoh via Digitalmars-d wrote:
> On Thu, Feb 26, 2015 at 06:06:04PM -0800, Andrei Alexandrescu via Digitalmars-d wrote:
>> On 2/26/15 5:59 PM, H. S. Teoh via Digitalmars-d wrote:
>>> On Thu, Feb 26, 2015 at 05:44:36PM -0800, Andrei Alexandrescu via Digitalmars-d wrote:
>>> [...]
>>>> An interesting option to explore in the future would be rigging
>>>> druntime to add opAddRef and opRelease to Object.
>>> [...]
>>>
>>> How would that work? Doesn't that immediately subject *all* classes
>>> to the restrictions set forth in DIP74?
>>
>> It does - but that might be fine with some applications. -- Andrei
>
> But putting it into druntime imposes it on *all* applications, because
> either opAddRef/opRelease are declared in Object, or they are not, and
> this decision is made long before the user writes his application.

That's why I used "rigging" - meaning "equip for special purpose". 
"Hacking" is clearer. Someone may decide to just add opAddRef/opRelease 
to Object for a system or application. Or make the addition subject to a 
versioning flag (and therefore have two druntime builds available).

Andrei



More information about the Digitalmars-d mailing list