Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a read-only var name as a for loop var should be an error #4342

Closed
krader1961 opened this issue Aug 18, 2017 · 1 comment
Closed

Using a read-only var name as a for loop var should be an error #4342

krader1961 opened this issue Aug 18, 2017 · 1 comment
Assignees
Labels
Milestone

Comments

@krader1961
Copy link
Contributor

@krader1961 krader1961 commented Aug 18, 2017

While working on #4200 I noticed that if you run this:

false
for status in 3 2 1
    echo $status
end
echo $status

You see this:

1
0
0
0

Rather than this (or an error):

3
2
1
0

Contrast with this:

$ set status 1
set: Tried to change the read-only variable 'status'
@krader1961 krader1961 added the bug label Aug 18, 2017
@krader1961 krader1961 modified the milestones: fish-future, fish-3.0 Aug 18, 2017
@krader1961
Copy link
Contributor Author

@krader1961 krader1961 commented Aug 19, 2017

I'm retargeting this for fish 3.0 because it is a backward incompatible change that can only be done in a major release. Now obviously anyone currently doing this type of thing is seeing unexpected, incorrect, behavior. Nonetheless, we should only fix it in a major release so let's make sure we do so for 3.0.

@krader1961 krader1961 self-assigned this Aug 20, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant