Powershell supports creating arrays with $array = 'a', 1, '3' . Then you can add an element to the array with $array += 4, but this creates a new array which is not performant.
Powershell should have a syntax which allows creating lists.
Assuming the operator is @[...], you could create a list with $list = @['a', 1, '3'] and then you could add an element to the existing list with $list += 4 without PowerShell having to create a new list.
Note: this new operator might function more like @(...)
This design assumes that changing , would be a breaking change. I'm open to discussing changing , as well.
I filed this based on an offline discussion about this comment on a PR: #5625 (comment)
Powershell supports creating arrays with
$array = 'a', 1, '3'. Then you can add an element to the array with$array += 4, but this creates a new array which is not performant.Powershell should have a syntax which allows creating lists.
Assuming the operator is
@[...], you could create a list with$list = @['a', 1, '3']and then you could add an element to the existing list with$list += 4without PowerShell having to create a new list.Note: this new operator might function more like
@(...)This design assumes that changing
,would be a breaking change. I'm open to discussing changing,as well.I filed this based on an offline discussion about this comment on a PR: #5625 (comment)