<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2015-11-01 6:02 GMT-08:00 Andrei Alexandrescu <span dir="ltr"><<a href="mailto:andrei@erdani.com" target="_blank">andrei@erdani.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 10/31/2015 11:35 PM, Michel Fortin wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I think it'd be more important to talk about auto-nulling weak<br>
references. That's a general concept that is necessary if you want<br>
reference counting to be useful and safe at the same time.<br>
</blockquote>
<br></span>
Agreed. We need to put weak pointers in the initial DIP and carry them through.<br>
<br></blockquote><div><br></div><div>It' doesn't looks like this kind of mechanism should be baked into the language. It come with a cost that maybe one doesn't want to pay. Maybe one is ok to fallback on the GC on that one. Maybe it is preferable to provide several kind of RC. Adn weak reference are just one variation one may wish.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Regarding opInc/opDec, here are some rules that the compiler may use:<br>
<br>
* Both are callable with an unsigned integer, 1 by default<br>
* opInc(n) followed by opDec(n) against the same object, with no call to isUniquelyReferenced in between, may be removed<br>
* opInc(n1) followed by opInc(n2) against the same object may be replaced with opInc(n1 + n2)<br>
* opDec(n1) followed by opDec(n2) against the same object may be replaced with opDec(n1 + n2)<br>
<br>
I'm trying to formalize a bit what removals and fusing the compiler should be allowed.<span><font color="#888888"><br>
</font></span><br></blockquote><div><br></div><div>Using intrinsic would sidestep this completely, even allowing to have several schemes.<br> <br></div></div></div></div>