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

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 27 13:16:59 PDT 2014


On 9/27/14, 12:50 PM, Dmitry Olshansky wrote:
> 27-Sep-2014 23:14, Andrei Alexandrescu пишет:
>> On 9/27/14, 2:38 AM, Dmitry Olshansky wrote:
>>>
>>> Okay it serves no good for me to make these tiny comments while on the
>>> go.
>>>
>>> As usual, structs are value types, so this feature can be mis-used, no
>>> two thoughts abouts it. It may need a bit of improvement in
>>> user-friendliness, compiler may help there by auto-detecting common
>>> misuse.
>>
>> I still don't understand what "this feature" is after reading your long
>> post twice.
>>
>> So structs are still value types and you replace postblit/destroy with
>> calls to opInc/opDec? That's it? How does this enable anything more
>> interesting than ctors/dtors?
>>
>
> Compiler is aware that opInc and opDec are indeed ref-countinng ops,
> meaning that opInc + opDec = no op. I claim that this is enough to get
> "ARC" going.

You give marginal details but still don't describe the thing. When are 
they called and what do they have that ctors/dtors/postblit don't?

FWIW the language always "understands" when to elide postblit/dtor calls.


Andrei




More information about the Digitalmars-d mailing list