Re: Trying to understand DIP1000

2017-05-05 Thread Dukc via Digitalmars-d-learn
On Friday, 5 May 2017 at 18:04:32 UTC, Dukc wrote: @safe void killDMan() { auto outer = [RefCountedSlice!int(1)]; foreach(ref fail; outer) { outer = [RefCountedSlice!int(1)]; gcActivationAttempt = new int[3]; fail[0] = 24; } } should be int[]

Re: Trying to understand DIP1000

2017-05-05 Thread Dukc via Digitalmars-d-learn
On Friday, 5 May 2017 at 18:04:32 UTC, Dukc wrote: The compiler is too cunning to let you to leak test[x] out of a function by reference, or take an address of it. Nor you can assing it to another variable, because that means copy semantics. And oh, the identity function won't fool the

Trying to understand DIP1000

2017-05-05 Thread Dukc via Digitalmars-d-learn
Walters exciting yesterday talk made me think about dip1000 again. I found out that I do not understand this: Containers that own their data will be able to give access to elements by scope ref. The compiler ensures that the references returned never outlive the container. Therefore, the