On 5/13/14, 6:41 AM, Dicebot wrote:
On Monday, 12 May 2014 at 19:00:33 UTC, Andrei Alexandrescu wrote:
For that I'm proposing we start real work toward a state-of-the-art
std.refcounted module. It would include adapters for class, array, and
pointer types, and should inform language improvements for qualifiers
(i.e. the tail-const problem), copy elision, literals, operators, and
such.

We don't have language tools to do it. Main problem with implementing
reference counted pointers as structs is that you are forced to abandon
polymorphism:

class A {}
class B : A {}

void foo(RefCounted!A) {}

void main()
{
     RefCounted!B b = new B();
     foo(b); // no way to make it work
}

This severely limits applicability of such library solution, especially
when it comes to something like exceptions.

"alias this" should be of help here. Could you please try it? Thanks! -- Andrei

Reply via email to