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

about_Automatic_Variables should be updated to indicate that automatic variables that are conceptually read-only can still be assigned to, and that that won't change for most of them so as not to break existing code #1510

Closed
5 tasks done
mklement0 opened this issue Aug 4, 2017 · 0 comments
Assignees
Labels
Pri2 Priority - Medium

Comments

@mklement0
Copy link
Contributor

From PowerShell/PowerShell#3061 (comment):

We discussed possibly making all automatic variables functionally read only, however, agreed that in many cases like $PWD someone could be using it already without problem as they didn't Set-Location so $PWD isn't overwritten. So other than $_, $PSItem, and $Input, we decided to error on the side of limiting the breaking change to the most common cases.

Therefore it should be noted in the documentation that other conceptually read-only variables, even though they can be written to - for backward compatibility - shouldn't be.

In PSv6, hopefully, a PSScriptAnalyzer rule will warn about doing so, but there's nothing in the engine that will enforce this.

Version(s) of document impacted

  • Impacts 6 document
  • Impacts 5.1 document
  • Impacts 5.0 document
  • Impacts 4.0 document
  • Impacts 3.0 document
@mklement0 mklement0 changed the title about_Automatic_Variables should be updated to indicate that automatic variables that are conceptually read-only can still be assigned to, and that won't change for most of them so as not to break existing code about_Automatic_Variables should be updated to indicate that automatic variables that are conceptually read-only can still be assigned to, and that that won't change for most of them so as not to break existing code Aug 4, 2017
@zjalexander zjalexander added the Pri2 Priority - Medium label Aug 30, 2017
@sdwheeler sdwheeler assigned sdwheeler and unassigned juanpablojofre Nov 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pri2 Priority - Medium
Projects
None yet
Development

No branches or pull requests

4 participants