On Mon, Aug 5, 2013 at 8:51 PM, Jonathan S. Shapiro <[email protected]>wrote:

>  static T escape1(ref T arg) { return arg; }
>>>
>>  static void escape2(ref X arg, T t) { arg.t = t }
>>> static void escape2(ref X arg, ref T t) { arg.t = t }
>>>
>>
>> All of these are creating copies of t, they don't allow the reference to
>> escape.
>>
>
> None of these are making copies of t. They are all making copies of the *
> reference* to T.
>

I see my mis-calculation. AFAIK, if T is a value type, all the above
statements make a copy of T and there is no escaping of the reference.
However, if T is a reference type, they make a copy of the reference to T,
which means the reference of the reference can't escape, but the reference
can.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to