DIP74: Reference Counted Class Objects

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 28 18:51:18 PST 2015


On 2/28/15 6:49 PM, Manu via Digitalmars-d wrote:
> On 1 March 2015 at 12:21, Andrei Alexandrescu via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
>> On 2/28/15 5:43 PM, Manu via Digitalmars-d wrote:
>>>
>>> I'd like to see a struct with RC operators have implicit calls
>>> generated (and elided) for exactly the same set of cases as classes,
>>> in terms of construction/destruction/assignment/passing to/from
>>> functions.
>>
>>
>> The short answer is that probably won't happen. -- Andrei
>
> *sigh* ... ever, or in DIP74?

In the foreseeable future.

> I presented my 80% case to you before. I just want this to work efficiently:
>
> extern(C) void inc(void*);
> extern(C) void dec(void*);
>
> struct X
> {
>    void *thing;
>
>    opInc() { inc(thing); }
>    opDec() { dec(thing); }
> }

struct X
{
   void *thing;

   this(this) { inc(thing); }
   ~this() { dec(thing); }
}


Andrei



More information about the Digitalmars-d mailing list