On Saturday, 6 February 2016 at 11:09:28 UTC, NX wrote:
On Saturday, 6 February 2016 at 10:29:32 UTC, Ola Fosheim Grøstad wrote:
What makes it impossible to have ref counted classes?

Nothing.

Then why do we need DIP74 ?

I think they aim for compiler optimizations, like ARC on Swift. But ARC requires all ref counting to be done behind the scene, so I think it is a bad idea for D to be honest.

And why documentation says RefCounted doesn't work with classes?

I don't use Phobos much. I think RefCounted creates a wrapper for an embedded struct or something. Something like struct { int refcount; T payload; }

Nothing prevents you from creating your own reference counting mechanism.

Reply via email to