DIP74: Reference Counted Class Objects

Manu via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 28 19:01:28 PST 2015


On 1 March 2015 at 12:51, Andrei Alexandrescu via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> 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); }
> }

You've conveniently ignored the word 'efficient'.
Okay, so if I'm not better off then I've always been, what is the good
of DIP74 to me?


More information about the Digitalmars-d mailing list