> Rather, it must be used according to the "simple rule" I mentioned: "Every 
> data type that either refers to the heap or contains something referring to 
> the heap must be created within an "owned" wrapper so that it can be either 
> "owned" or cast to the distinct "dangling" wrapper according to the rules of 
> its copy/move semantics.

This "owned wrapper" becomes a memory region with all its known up- and 
downsides: Faster, uses more memory, freeing a "subobject" inside the region is 
either impossible or really problematic for memory safety.

> So the next question is: Given such a simple rule, it seems that the compiler 
> will be able to check whether "owned" needs to be applied or not and can 
> guide the programmer, then could the compiler insert the "owned" wrapper 
> itself when necessary on creation?

Owned vs non-owned looked intractable to compute to me. Sure, you can "infer" 
it in lots of places but then the restrictions remain and error messages 
referring to concepts that are invisible/inferred in/from the source code are 
usually a bad user experience. I'd rather put more effort into detecting 
dangling refs at compile-time. :-)

Reply via email to