On Sat, Jan 4, 2014 at 7:05 PM, William ML Leslie < [email protected]> wrote:
> On 4 January 2014 12:40, Jonathan S. Shapiro <[email protected]> wrote: > > Does this idea that instances of interfaces have a lifetime restriction > > work? What do people think? > > I like it. > > Does it work? Well, without having formalising it in a Tofte-Talpin > derivative; I /think/ it works. I'm afraid I asked a poorly specified question. I'm completely certain that it works from a typing perspective. My intended question was: does this feel like it should work pragmatically? This is one of those cases where it > would be convenient to run an analysis over a large body of code to > see if this is how people are using interfaces, and for those cases > that they are not, how often one of the obvious solutions can be used. > Yes and no. It's good to understand existing usage. But much depends on what idioms the language encourages. > > Note that if the underlying type is a reference type, this doesn't really > > impose any meaningful restriction on the corresponding interface objects. > > When it's challenging to resolve the lifetimes, the compiler will just > end > > up pushing both the reference object and it's associated interface > instance > > into. > > into? > Sorry. Into the maximal region, or as you say: into the heap. Which is to say, the region governed by GC. > How will the error > message look in heap-free programs? It's a violation of the NoHeap effect, so it would show up as a type error. In practice, this should only occur with interfaces to objects of reference type, which are themselves already heap allocated. If so, there are pre-existing noheap violations. shap
_______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
