Title: Set-StrictMode should detect use of automatic variables as parameters or the target of an assignment · Issue #3061 · PowerShell/PowerShell · GitHub
Open Graph Title: Set-StrictMode should detect use of automatic variables as parameters or the target of an assignment · Issue #3061 · PowerShell/PowerShell
X Title: Set-StrictMode should detect use of automatic variables as parameters or the target of an assignment · Issue #3061 · PowerShell/PowerShell
Description: It's common for people to inadvertently to use an automatic variable as a parameter name or a variable name, and then get confused when it doesn't contain the value they expect. This is just one example but it comes up fairly often, and ...
Open Graph Description: It's common for people to inadvertently to use an automatic variable as a parameter name or a variable name, and then get confused when it doesn't contain the value they expect. This is just one ex...
X Description: It's common for people to inadvertently to use an automatic variable as a parameter name or a variable name, and then get confused when it doesn't contain the value they expect. This is jus...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/3061
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Set-StrictMode should detect use of automatic variables as parameters or the target of an assignment","articleBody":"It's common for people to inadvertently to use an [automatic variable](https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.core/about/about_automatic_variables) as a parameter name or a variable name, and then get confused when it doesn't contain the value they expect.\r\n\r\n[This is just one example](http://stackoverflow.com/q/41899833/3905079) but it comes up fairly often, and unless you already know the name is reserved, PowerShell doesn't offer you any clues as to what's going on.\r\n\r\nBecause the various automatic variables get overwritten based on different conditions, it can be even more confusing when it seems to work in one context but not another.\r\n\r\nGiven `Set-StrictMode`'s other roles, this seems like a good fit.\r\n\r\nOne intentional use is for nullification, as in:\r\n\r\n $null = Invoke-CommandWithUnwantedOutput\r\n\r\nSo that could be an exception (because it's unlikely to be done unintentionally), but my thoughts are that there are other ways to achieve this, and strict mode is not enabled by default, so in my opinion it should not be an exception.","author":{"url":"https://github.com/briantist","@type":"Person","name":"briantist"},"datePublished":"2017-01-27T18:29:16Z","url":"https://github.com/PowerShell/PowerShell/issues/3061"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e04e008f-a53f-998e-9c97-2e91519f1fde |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E0D6:292B7E:2F4603:413F0C:6AFDA499 |
| html-safe-nonce | d4c995bc76567d5aa86488708b886f2b22c84d38ef8e1fc654b4dd0623724d03 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMEQ2OjI5MkI3RToyRjQ2MDM6NDEzRjBDOjZBRkRBNDk5IiwidmlzaXRvcl9pZCI6Ijc1MzUyOTczNDY5NjgzMzE0MTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | beb1f4a843f49d9964de61710622869864d18f3ba9be240ec9c0f41e745a7a7f |
| hovercard-subject-tag | issue:203706204 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/3061/issue_layout |
| twitter:image | https://opengraph.githubassets.com/16247238fd2c2990e31f0b3c6abec52f291d12f05578bdf103a46826ffe35ff4/PowerShell/PowerShell/issues/3061 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/16247238fd2c2990e31f0b3c6abec52f291d12f05578bdf103a46826ffe35ff4/PowerShell/PowerShell/issues/3061 |
| og:image:alt | It's common for people to inadvertently to use an automatic variable as a parameter name or a variable name, and then get confused when it doesn't contain the value they expect. This is just one ex... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | briantist |
| hostname | github.com |
| expected-hostname | github.com |
| None | bc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0ddf53eb35c87f1f8df13dbf75c3bdadbfc6e969 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width