On Tue, Jul 30, 2013 at 2:30 PM, Jonathan S. Shapiro <[email protected]>wrote:

> I think it's also useful to add a notion of region-based "borrowed"
> references. A borrowed reference is guaranteed not to be the last reference
> to an object.
>

I don't understand what you mean here, can you clarify?

Since I'm assuming GC is running on all regions at all times, all box
references are real and traced. Like in standard CLR, all ref (interior
pointers) are "borrowed" and rely on the guarantee that a specific pointer
to the box outlives the ref.

Is that the "borrowed" what you're talking about above?


> There are a bunch of cases where interior pointers cannot be returned
> safely unless you have a region-based type system. In languages that
> require memory safety, the usual workarounds are (1) return a dynamically
> allocated copy, or (b) add indirection in the original data type so that
> you can share substructure.
>

I'll go read the Cyclone paper. In the meantime, how do regions help you
here? Because GC is running all the time, a region held on a higher
stack-frame does not make any guarantees about liveliness of a particular
box in the region. We have to put the specific box on the stack to borrow a
ref/interior pointer.

In a previous email I mentioned how a Rust-like lifetime system could be
used to return interior ref pointers in CLR by also returning an implicit
(hidden) pointer to the box which the runtime knows must outlive the
borrowed ref. However, this mechanism doesn't seem at all related to
regions.

Is there is something I'm not seeing?
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to