On Tue, Jan 24, 2006 at 12:11:14AM -0000, Jonathan Worthington wrote:
> .NET has these managed reference thingies.  They're basically like 
> pointers, but safe.  [...]
> 
> Making them work on Parrot is no problem.  Making them work without 
> comprimising the safety of the VM is harder.  Amongst the things you can 
> get a pointer to are parameters and local variables.  Under .NET that means 
> stack locations; with Parrot that means registers.

Indeed, and yet pointing to registers is not as fatal as you might
imagine, nor does it require restructuring the VM by e.g. adding a
register type.

The trick is to keep references to registers in a way that notices
when the register set is gone, or alternatively, that keeps the
register set from going away.  The latter is already achieved by the
default LexPad implementation.

Therefore, the representation of a safe pointer to a register would
not, in fact, be a pointer to the register's storage in memory, but
rather a weak reference (or, conceivably, a strong one?  I doubt it)
plus an integer register number.

Is a pointer to a register the only tough case?

And in what way is this different from the Reference type we're going
to have to make work just for e.g. the Perl backslash operator?

(Actually, I'm still a little fuzzy on actual usage patterns for this
kind of thing.  Otherwise I'd probably know those answers.)
-- 
Chip Salzenberg <[EMAIL PROTECTED]>

Reply via email to