DIP74: Reference Counted Class Objects

Manu via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 27 07:17:59 PST 2015


On 27 February 2015 at 07:50, Andrei Alexandrescu via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> http://wiki.dlang.org/DIP74 got to reviewable form. Please destroy and
> discuss.
>
> Thanks,
>
> Andrei

I'm excited for this. I'm very happy with the approach.
I'm particularly happy that it is implemented as a pair of operators.
This is what I've always hoped it to look like.

My initial reactions are:

There's no mention of const/immutable...? Surely we can have RC
immutable things right? I can't see how that works here... but it's
very important.

I'm not clear on structs. What is the order for calls; postblit,
opInc, opDec, destructor? 75% of my use cases today are thin structs
that wrap C/C++ api's.

There's no mention of 'scope'. I presume functions that receive scope
RC arguments will have the opportunity to have opAddRef/opRelesae
elided around the call?

I wonder if some standard GetRefCount function should exist? Otherwise
they will probably end up being named all sorts of different things. I
guess I can't think of any value in a standardisation of the function
otherwise though...


More information about the Digitalmars-d mailing list