RFC: reference counted Throwable

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 21 11:17:03 PDT 2014


21-Sep-2014 19:03, Andrei Alexandrescu пишет:
> On 9/21/14, 1:51 AM, Jacob Carlborg wrote:
>> On 2014-09-20 18:56, Andrei Alexandrescu wrote:
>>
>>> Please don't take me in a court of law. But yes, I am talking about the
>>> compiler inserting calls to increment and decrement reference counts. --
>>> Andrei
>>
>> We do need to know what you're proposal is for.
>
[snip]
>
> (For practical reasons, RCObject will implement IUnknown. There are a
> few random consequences of that (meaningless method QueryInterface, no
> class info, no monitor, COM-compatible layout) but IUnknown already has
> AddRef and Release and the compiler already recognizes IUnknown as a
> special case. Hooking RCObject there will leave us with two roots
> instead of adding a third one.)
>

This is actually a nice choice since COM would then (eventually) benefit 
from whatever automatic ref-counting we embed into the compiler.
This is exactly what Visual C++ does now for new style COM object 
(inherited from IInspectable).

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list