"Nicholas Clark" <[EMAIL PROTECTED]> wrote:
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
Ah. This was the purpose of part (a) - to make sure we can't assign the reference to an aggregate (the .NET spec forbids storing a managed reference in "elements of arrays or fields of objects or value types"). Though I explicitly said make set MMD and forgot to mention (as leo had commented on IRC) that you'd need to do it for keyed sets too, so my fault for the confusion - sorry.

Looking at what Chip said though, it would appear that the much cleaner solution I was hoping to find exists and can be found in lex pad stuff, which I need to go stare at for a bit before replying. :-)

Thanks,

Jonathan

Reply via email to