http://wiki.dlang.org/DIP25

Peter Alexander via Digitalmars-d digitalmars-d at puremagic.com
Sun Dec 28 12:04:52 PST 2014


On Sunday, 28 December 2014 at 18:16:04 UTC, Andrei Alexandrescu 
wrote:
> Very little breakage I can think of. Ranges usually don't own 
> their payload.

I'm thinking more about higher order ranges, e.g. take, filter, 
cycle, retro; over a mutable range with ref front. Even if the 
underlying range (e.g. an array) has the inout, the higher order 
range will need the inout as well, so that it is propagated, no?


>> auto ref foo(ref int x) { return x; }  // non-ref due to lack 
>> of inout
>> on x?
>
> "auto" has no meaning there. It does here:
>
> auto ref foo(auto ref int x) { return x; }
>
> This wouldn't compile anymore - inout is needed for x as well.

Ah, yep. That's what I meant :-)  Thanks for the clarification.



More information about the Digitalmars-d mailing list