Escaping the Tyranny of the GC: std.rcstring, first blood

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 23 08:12:43 PDT 2014


On 9/22/14, 11:47 PM, Manu via Digitalmars-d wrote:
> On 23 September 2014 16:19, deadalnix via Digitalmars-d
> <digitalmars-d at puremagic.com <mailto:digitalmars-d at puremagic.com>> wrote:
>
>     On Tuesday, 23 September 2014 at 03:03:49 UTC, Manu via
>     Digitalmars-d wrote:
>
>         I still think most of those users would accept RC instead of GC.
>         Why not
>         support RC in the language, and make all of this library noise
>         redundant?
>         Library RC can't really optimise well, RC requires language
>         support to
>         elide ref fiddling.
>
>
>     I think a library solution + intrinsic for increment/decrement (so
>     they can be better optimized) would be the best option.
>
>
> Right, that's pretty much how I imagined it too. Like ranges, where
> foreach makes implicit calls to contractual methods, there would also be
> a contract for refcounted objects, and the compiler will emit implicit
> calls to inc/dec if they exist?
> That should eliminate 'RefCounted', you would only need to provide
> opInc()/opDec() and rc fiddling calls would be generated automatically?
> Then we can preserve the type of things, rather than obscuring them in
> layers of wrapper templates...

That won't work. Sorry, it has too many holes to enumerate! -- Andrei



More information about the Digitalmars-d mailing list