DIP69 - Implement scope for escape proof references

via Digitalmars-d digitalmars-d at puremagic.com
Tue Dec 9 11:39:30 PST 2014


On Monday, 8 December 2014 at 23:00:05 UTC, deadalnix wrote:
> This is inherently about ownership. I have a proposal about 
> this.
> Scope is about using things without ownership.
>
> Both are linked but different beast.

Not really different. The activation record (stack frame) is 
conceptually an object. Scoped objects are owned by the 
activation record. You have the same problem when handing out 
references to parts of composite objects.

When propagating references down a call chain you can keep track 
of the associated call-depth, when the call-depth associated with 
the reference is greater than 0, then it safe to return the 
reference from a function. Right?



More information about the Digitalmars-d mailing list