On 11 October 2015 at 17:10, Andrei Alexandrescu via Digitalmars-d
<digitalmars-d@puremagic.com> wrote:
> On 10/11/15 9:48 AM, Manu via Digitalmars-d wrote:
>>
>> C++ basically implemented rval-references to
>> improve (not solve) the RC problem...
>
>
> Interesting, haven't heard of this viewpoint. Could you please give detail
> on that? -- Andrei

Yeah, that is a terrible claim, but that do offer some advantage (in
this situation as with others).

The language doesn't support ref counting; constructors/destructors
are a pretty crude mechanism to implement them, since they don't model
the ref-counting pattern but a superset, which technically allows it
to work, but it's pretty lame and inefficient to do ref-counting this
way, and it's impossible for code (or the compiler) to distinguish
between actual ref-counting events and must behave conservatively.
rvalue-references allow the language to elide some unnecessary
assignment logic, which can be further used to perform some inc/dec
elision, but it starts to get extremely complex at this point, and it
still doesn't do the trick. It's a sort of band-aid, but certainly not
just for RC.

Reply via email to