<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 23 September 2014 15:37, Andrei Alexandrescu via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On 9/22/14, 9:53 PM, Manu via Digitalmars-d wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">
On 23 September 2014 14:41, Andrei Alexandrescu via Digitalmars-d<br></span><span class="">
<<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a> <mailto:<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@<u></u>puremagic.com</a>>> wrote:<br>
<br>
    On 9/22/14, 8:03 PM, Manu via Digitalmars-d wrote:<br>
<br>
        I still think most of those users would accept RC instead of GC.<br>
        Why not<br>
        support RC in the language, and make all of this library noise<br>
        redundant?<br>
<br>
<br>
    A combo approach language + library delivers the most punch.<br>
<br>
<br></span><span class="">
How so? In what instances are complicated templates superior to a<br>
language RC type?<br>
</span></blockquote>
<br>
It just works out that way. I don't know exactly why. In fact I have an idea why, but conveying it requires building a bunch of context.<br></blockquote><div><br></div><div>The trouble with library types like RefCounted!, is that they appear to be conceptually backwards to me.</div><div>RefCounted!T suggests that T is a parameter to RefCounted, ie, RefCounted is the significant object, not 'T', which is what I actually want. T is just some parameter... I want a ref-counted T, not a T RefCounted, if that makes sense.</div><div>When we have T* or T[], we don't lose the 'T'-ness of the object, we're just appending a certain type of pointer, and I really think that RC should be applied the same way.</div><div><br></div><div>All these library solutions make T into something else, and that has a tendency to complicate generic code in my experience. In most cases, templates are used to capture some type of thing, but in these RefCounted style cases, it's backwards, it effectively obscures the type. We end out with inevitable code like is(T == RefCounted!U, U) to get U from T, which is the thing we typically want to know about, and every instance of a template like this must be special-cased; they can't be rolled into PointerTarget!T, or other patterns like Unqual!T can't affect these cases (not applicable here, but the reliable pattern is what I refer to).</div><div><br></div><div>I guess I'm saying, RC should be a type of pointer, not a type of thing... otherwise generic code that deals with particular things always seems to run into complications when it expects particular things, and gets something that looks like a completely different sort of thing.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">
        Library RC can't really optimise well, RC requires language<br>
        support to<br>
        elide ref fiddling.<br>
<br>
<br>
    For class objects that's what's going to happen indeed.<br>
<br>
<br></span><span class="">
Where is this discussion? Last time I raised it, it was fiercely shut<br>
down and dismissed.<br>
</span></blockquote>
<br>
Consider yourself vindicated! (Not really, the design will be different from what you asked.) The relevant discussion is entitled "RFC: reference counted Throwable", and you've already participated to it :o).</blockquote><div><br></div><div>I see. I didn't really get that from that thread, but I only skimmed it quite quickly, since I missed most of the action.</div><div><br></div><div>I also don't think I ever insisted on a particular design, I asked to have it *explored* (I think I made that point quite clearly), and suggested a design that made sense to me. The idea was shut down in principle, no competing design's explored.</div><div>I'm very happy to see renewed interest in the topic :)</div></div></div></div>