Title: Feature Request: Support +/-/+=/-= operators for all IList types · Issue #13152 · PowerShell/PowerShell · GitHub
Open Graph Title: Feature Request: Support +/-/+=/-= operators for all IList types · Issue #13152 · PowerShell/PowerShell
X Title: Feature Request: Support +/-/+=/-= operators for all IList types · Issue #13152 · PowerShell/PowerShell
Description: Summary of the new feature/enhancement Using modern types such as List/OrderedList/SortedList/etc. is becoming more common for performance reasons, but the array manipulation operators reconstruct these as [Object[]] which is not ideal f...
Open Graph Description: Summary of the new feature/enhancement Using modern types such as List/OrderedList/SortedList/etc. is becoming more common for performance reasons, but the array manipulation operators reconstruct ...
X Description: Summary of the new feature/enhancement Using modern types such as List/OrderedList/SortedList/etc. is becoming more common for performance reasons, but the array manipulation operators reconstruct ...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/13152
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Feature Request: Support +/-/+=/-= operators for all IList types","articleBody":"## Summary of the new feature/enhancement\r\n\r\nUsing modern types such as List/OrderedList/SortedList/etc. is becoming more common for performance reasons, but the array manipulation operators reconstruct these as `[Object[]]` which is not ideal for many already discussed reasons, and using other syntax such as `.Add()` is awkward especially for newer Powershell Users. `Dictionary` does not have this issue as the property assignment operators work fine.\r\n\r\nI propose that, if a class implements `IList` and does not have `op_Addition` or `op_Subtraction` already defined, that the operators will use the standard `IList` `Add` and `Remove` methods to manipulate the array and preserve it rather than recasting all the contents into a new `[Object[]]`.\r\n\r\nThis will allow users who want to use more advanced types for performance to be able to do so without breaking any behavior of `@()` syntax or normal powershell user experience.\r\n\r\nNOTE: https://github.com/PowerShell/PowerShell/issues/5643 proposed a lot of syntactic sugar around lists or replacing the default type with lists. This Feature Request is smaller in scope but compatible and is less likely to cause breaking regressions.\r\n\r\n\r\n## Potential Breaking Changes\r\n1. Scripts that anticipate the existing behavior of casting to an `[Object[]]` and work around it could break, but it would have to be very specific and very rare edge case, for instance something that recasts it to a list would simply just cast a list to a list and not break. Could be controlled with a preference variable\r\n\r\n\r\n## EDITS\r\n\r\n1. Narrowed scope to just `+=` and `-=` operators due to @SeeminglyScience's valid concerns","author":{"url":"https://github.com/JustinGrote","@type":"Person","name":"JustinGrote"},"datePublished":"2020-07-10T16:29:11Z","url":"https://github.com/PowerShell/PowerShell/issues/13152"}
| 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:f16ac0dc-54d5-6433-21b5-7b049d0bb1ab |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 828E:2A37BB:41F7D:5B0F8:6AFDA8C6 |
| html-safe-nonce | 82eb7126d06dbfb4b7e6e4a520c5e49da22dd12db35eb07a720f9f86d173b953 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MjhFOjJBMzdCQjo0MUY3RDo1QjBGODo2QUZEQThDNiIsInZpc2l0b3JfaWQiOiI0MzU1NTU2ODQ4MTE2Mjc5NDk0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 85b281d91ca71bb5f387c330717439563a0b04fa380b89975f7be865af148cbb |
| hovercard-subject-tag | issue:654896827 |
| 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/13152/issue_layout |
| twitter:image | https://opengraph.githubassets.com/26671aa8e55b7185342375c1ac0a85484981bee83a1ea4c5e15a610148e1ee36/PowerShell/PowerShell/issues/13152 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/26671aa8e55b7185342375c1ac0a85484981bee83a1ea4c5e15a610148e1ee36/PowerShell/PowerShell/issues/13152 |
| og:image:alt | Summary of the new feature/enhancement Using modern types such as List/OrderedList/SortedList/etc. is becoming more common for performance reasons, but the array manipulation operators reconstruct ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JustinGrote |
| 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