DIP69 - Implement scope for escape proof references

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 22 00:04:20 PST 2014


On Monday, 22 December 2014 at 03:07:53 UTC, Walter Bright wrote:
> On 12/21/2014 2:06 AM, Dicebot wrote:
>> No, it is exactly the other way around. The very point of what 
>> I am saying is
>> that you DOESN'T CARE about ownership as long as worst case 
>> scenario is
>> assumed.   I have zero idea why you identify it is conflating 
>> as ownership when
>> it is explicitly designed to be distinct.
>
> The point of transitive scoping would be if the root owned the 
> data reachable through the root.

Quoting myself:

> For me "scopeness" is a property of "view", not object itself - 
> this also makes ownership method of actual data irrelevant. Only
> difference between GC owned data and stack allocated one is that
> former can have scoped view optionally but for the latter
> compiler must force it as the only available.

It doesn't matter of root owns the data. We _assume_ that as 
worst case scenario and allowed actions form a strict subset of 
allowed actions for any other ownership situation. Such `scope` 
for stack/GC is same as `const` for mutable/immutable  - common 
denominator.

Point of transitive scope is to make easy to expose complex 
custom data structures without breaking memory safety.


More information about the Digitalmars-d mailing list