You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-Draft/RFC0014-Language enhancements for collections.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,15 @@
2
2
RFC: RFC0014
3
3
Author: Aditya Patwardhan
4
4
Status: Draft
5
-
SupercededBy:
5
+
SupercededBy:
6
6
Version: 1.0
7
7
Area: LanguageAndParser
8
8
Comments Due: 02/01/2017
9
9
---
10
10
11
-
# Language enhancements for collections
11
+
# Language enhancements for collections
12
12
13
-
System.Collections namespace has many collections that are frequently used in PowerShell scripts. To instantiate objects of these classes, New-Object and the type name has to be used. With Powershell v5 and above the ```[typename]::new() ``` can be used, by still needs the full type name. This RFC proposes a way to simplify the instantiation of types in System.Collections namespace.
13
+
System.Collections namespace has many collections that are frequently used in PowerShell scripts. To instantiate objects of these classes, New-Object and the type name has to be used. With Powershell v5 and above the ```[typename]::new() ``` can be used, by still needs the full type name. This RFC proposes a way to simplify the instantiation of types in System.Collections namespace.
14
14
15
15
## Motivation
16
16
@@ -20,7 +20,7 @@ The various ways user can instantiate these classes currently is as follows:
20
20
$list = New-Object System.Collections.ArrayList
21
21
$list = [System.Collections.ArrayList]::new()
22
22
```
23
-
Collections are used frequently in PowerShell scripts, we can make the instantiating collections easier.
23
+
Collections are used frequently in PowerShell scripts, we can make the instantiating collections easier.
24
24
25
25
Performing a search on GitHub for usage of collections we know which collection type is used more frequently.
26
26
@@ -65,10 +65,14 @@ $stack = [stack] @(1,2,3)
65
65
66
66
### New operator for list, queue and stack
67
67
68
-
A new operator can be proposed which creates a list, say @[] / @<> etc. This would mean we would need to make changes to the Parser to support the new operator. Since all the collections are single dimensional and an array operator is very familiar to users, adding a new operator would have a learning curve and discoverability issue.
68
+
A new operator can be proposed which creates a list, say @[] / @<> etc. This would mean we would need to make changes to the Parser to support the new operator. Since all the collections are single dimensional and an array operator is very familiar to users, adding a new operator would have a learning curve and discoverability issue.
69
69
70
70
### Alternative names for collections
71
71
72
-
The RFC proposes to use list, queue and stack for System.Collections.ArrayList, System.Collections.Queue and System.Collections.Stack respectively. Type accelerator names for Queue and Stack are same as class names.
73
-
Using 'list' is proposed for System.Collections.ArrayList instead of 'ArrayList' for brevity, 'ArrayList' is too long.
72
+
The RFC proposes to use list, queue and stack for System.Collections.ArrayList, System.Collections.Queue and System.Collections.Stack respectively. Type accelerator names for Queue and Stack are same as class names.
73
+
Using 'list' is proposed for System.Collections.ArrayList instead of 'ArrayList' for brevity, 'ArrayList' is too long.
74
74
75
+
76
+
### Scope
77
+
78
+
Type accelerators for generic types for collections are out of scope for this RFC. They might be addressed in future RFCs.
0 commit comments