On Tue, Jan 24, 2006 at 12:11:14AM -0000, Jonathan Worthington wrote:

> .NET has these managed reference thingies.  They're basically like 


> b) Add a v-table flag saying "returning me is forbidden" and checking that 
> on any PMCs that get returned.  (However, there are subtle issues.  For 
> example, we want to be able to pass the PMC to methods that are called from 
> this one - after all, it's how byref passing is implemented.  But with tail 
> calls we should probably not do it.  Also haven't yet pondered if closures 
> or co-routines may lead to some kinda leakage.)

I don't think that this is going to work. You can bypass the check on
returning one of these merely by assigning it into an aggregate that was
passed in by reference. Neither the managed reference PMC nor the aggregate
is returned, yet the managed reference outlives the function and is
accessible.

Nicholas Clark

Reply via email to