On Friday, 27 February 2015 at 21:21:08 UTC, Andrei Alexandrescu wrote:
On 2/27/15 1:02 PM, Michel Fortin wrote:
On 2015-02-27 20:34:08 +0000, Steven Schveighoffer said:
void main()
{
   C2 c2 = new C2;
   c2.c = new C;
   foo(c2.c, c2);
}

Still same question. The issue here is how do you know that the reference that you are sure is keeping the thing alive is not going to
release it through some back door.
There are surely other cases, but you get the idea. These three
situations are probably the most common, especially the first one. For instance, inside a member function, 'this' is a local variable and you will never pass it to another function by ref, so it's safe to call
'this.otherFunction()' without retaining 'this' first.

Thanks. So it seems we continue as we were with DIP74 and leave the rest to the implementation.

Hey, I don't think so. I think I figured it out. Keep track "in house" of which parameters get opReleased, and have the compiler insert addRef and opRelease at entry and exit to the function itself. No performance penalty, no parameter attribute, no nothin'. Just an in-house tracking mechanism. Eh???

Reply via email to