Proposal : aggregated dlang git repository

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 10 21:37:37 PST 2015


On Wed, Feb 11, 2015 at 03:20:57AM +0000, weaselcat via Digitalmars-d wrote:
[...]
> I was just using RefCounted!T as one example of a major headache I've
> had with D.
[...]

Jakob Ovrum has just submitted a PR to make (the current version of)
RefCounted reject interfaces, since currently it doesn't do that
correctly (it refcounts the reference to the interface rather than the
target object).

Given this is the current situation, it would appear to me to make
RefCounted work with class objects, "all" we have to do would be to
specialize RefCounted for classes, use malloc to allocate the necessary
space (plus the refcount, of course), and emplace() the class object
onto that space. Right?

Of course, given that it has been ... oh, months? years? since
RefCounted issues have been addressed, I'm probably just kidding myself
that there are no major monkey wrenches in the works that would make the
above simplistic solution not work. And I'm not sure I really want to
know... Not until I have an actual use case for RefCounted in my own
code, anyway, since otherwise I wouldn't have any confidence that I was
making the right decisions in making any changes to it.


T

-- 
The fact that anyone still uses AOL shows that even the presence of options doesn't stop some people from picking the pessimal one. - Mike Ellis


More information about the Digitalmars-d mailing list