DIP69 - Implement scope for escape proof references

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 10 19:30:01 PST 2014


On 12/9/2014 8:34 PM, Dicebot wrote:
> But as far as I understand the spec it will result it this code failing too:
>
> auto r = ["aaa", "bbb", "ccc"].map!foo;
> // should compile but will fail because foo returns scope  ref:
> string s = r.front;
>
> What I mean is that in current proposal it is impossible to transfer scope
> information down the call chain - either function always returns scope ref or
> never. Which implies the necessity of something like `auto scope`...

If you want data to 'escape' from r.front, then it shouldn't be marked as scope. 
Definitely, using scope successfully will require some rethinking of how code is 
written.


More information about the Digitalmars-d mailing list