DIP 1022--foreach auto ref--Community Review Round 1

Dukc ajieskola at gmail.com
Thu Aug 8 12:52:43 UTC 2019


On Thursday, 8 August 2019 at 12:38:51 UTC, rikki cattermole 
wrote:
> - In the first alternative a disadvantage is listed but no 
> advantages. An advantage of it is that there would be no 
> breaking changes unlike the proposed solution which has an 
> unknown amount of breakage.

Read the paragraph slower :D.

>
> If we could get an idea of the severity (1-2 modules vs half vs 
> almost all of Phobos) of the breakage being proposed, that 
> would great.

Remember that nothing will break before deprecation period ends. 
If it proves to be too bad we can back up and go with alternative 
#1 instead.

>
> - What is the interaction with indexes? No mention of them, nor 
> example.

Yes, this is likely worth an explicit mention. Same as with the 
equivalent regular or ref foreach, depending on which is chosen 
according to the rules menitoned on the DIP.

>
> - The examples you have may look good for an implementer, but 
> for everybody else perhaps some examples using concrete types 
> that ignore the foreach body would be a good edition. Just to 
> make it clear what we're getting out of it. I.e.
>
> RangeWithoutRefFront expr; // T front()
>
> foreach(v; expr) // ok
> foreach(ref v; expr) // Success but will be error after 
> deprecation
> foreach(auto ref v; expr) // ok

Isn't the EMSI-containers example already like yours? Or did you 
mean that your example as how-not-to example?




More information about the Digitalmars-d mailing list