Things that keep D from evolving?
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Feb 6 09:22:03 PST 2016
On Saturday, 6 February 2016 at 11:15:06 UTC, Ola Fosheim Grøstad
wrote:
> Nothing prevents you from creating your own reference counting
> mechanism.
A struct wrapper doesn't give the things you need to reliably
handle inheritance.
interface A {}
interface B {}
class C : A, B {}
void use(RefCounted!A) {}
RefCounted!C c;
use(c);
With alias this tricks, you can handle one level of inheritance,
you could make it return a RefCounted!A or B, but not both.
Multiple alias this could solve this... but that PR is in limbo
again AFAIK.
Of course, you could just write some named function to return the
right interface and tell the user to call it, but it won't be an
implicit conversion like it is with interfaces normally.
(BTW, for the record, I have no problem with named functions, it
just is different than the built-in thing.)
More information about the Digitalmars-d-learn
mailing list