Safe Usage of Mutable Ranges in foreach scopes

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 9 05:59:01 PDT 2015


On Friday, 8 May 2015 at 11:25:26 UTC, Per Nordlöw wrote:
> Could the scope keyword be used here?
>
> Could the work done in DIP-25 be reused here, Walter?

I had `scope!(const ...)` in my original proposal [1] to handle 
exactly this problem. The latest iteration doesn't have it as an 
explicit annotation anymore, but the functionality is still there 
in the way it interacts with `@safe` [2].

It's no longer opt-in, because it turned out that `byLine` is 
just a special case of a more general problem. This became clear 
during the discussion of RCArray/DIP25 [3].

[1] 
http://wiki.dlang.org/User:Schuetzm/scope#scope.21.28const_....29
[2] 
http://wiki.dlang.org/User:Schuetzm/scope3#.40safe-ty_violations_with_borrowing
[3] 
http://forum.dlang.org/thread/huspgmeupgobjubtsmfe@forum.dlang.org


More information about the Digitalmars-d-learn mailing list