RFC: reference counted Throwable
Dicebot via Digitalmars-d
digitalmars-d at puremagic.com
Sun Sep 21 08:09:43 PDT 2014
On Sunday, 21 September 2014 at 15:03:09 UTC, Andrei Alexandrescu
wrote:
> 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.
>
> The title is an incomplete summary. Exceptions would be
> transparently reference counted. I.e. no changes in user code.
>
> A little more detail on a design Walter has put together:
> define a new root class RCObject. Neither Object nor RCObject
> inherit each other. All classes that inherit RCObject are
> detected by the compiler as reference counted.
>
> (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.)
>
> Throwable will inherit RCObject. The compiler inserts AddRef
> and Release whenever copying RCObject (and derivatives)
> references around, of course following a null check.
>
> The caveats discussed previously in http://goo.gl/Xl5U3z do
> apply.
>
>
> Andrei
This makes much more sense to me than initial proposal. I may
even be brave enough to say that I like it :)
More information about the Digitalmars-d
mailing list