Kenji Hara <> changed:

           What    |Removed                     |Added
           Keywords|                            |wrong-code

--- Comment #10 from Kenji Hara <> 2012-06-15 19:40:31 PDT 
(In reply to comment #9)
> (In reply to comment #8)
> > To reduce breaking of existing codes,
> > 1. Warn to modifying loop variable in foreach body.
> >    It is shown only when -w switch is specified.
> > 2. Deprecate modifying loop variable in foreach body.
> >    If user specifies -d switch, it is allowed.
> > 3. Allow modifying loop variable in foreach body, and it does not affect to
> >    the number of iterations of the loop.
> This is great, you are the best Kenji Hara.
> I prefer the number 2. I think it breaks none of my programs.

They are the phases to change behavior. I think we should allow modifying loop
variable in foreach body, but it should not affect to iteration.

> The number 3 is a trap, because it silently changes the semantics of old D
> code. And it's bug-prone for new D programmers too because they can change the
> variable by mistake. Generally immutable variables are safer.

#3 is a goal.

> Are you able and willing to compile the whole Phobos with the option number 2?
> So we can see how often Phobos code change the foreach-on-range iteration
> variable.
See auto tester. With all pull request, Phobos compile succeeds. So there is no
code that changes the foreach-on-range iteration variable.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to