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/RFCNNNN-Optional-Features.md
+23-20Lines changed: 23 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,15 +11,15 @@ Plan to implement: Yes
11
11
12
12
# Optional features in PowerShell
13
13
14
-
There are several important issues in the PowerShell language that cannot be corrected without introducing breaking changes. At the same time, the number of breaking changes introduced in a new version of PowerShell needs to be as minimal as possible, so that there is a low barrier to adoption of new versions, allowing community members can transition scripts and modules across versions more easily. Given that those two statements are in conflict with one another, we need to consider how we can optionally introduce breaking changes into PowerShell over time.
14
+
There are several important issues in the PowerShell language that cannot be corrected without introducing breaking changes. At the same time, the number of breaking changes introduced in a new version of PowerShell needs to be as minimal as possible, so that there is a low barrier to adoption of new versions, allowing community members to transition scripts and modules across versions more easily. Given that those two statements are in conflict with one another, we need to consider how we can optionally introduce breaking changes into PowerShell over time.
15
15
16
-
PowerShell has support for experimental features, which some may think covers this need; however, the intent of experimental features is to allow the community to try pre-release versions of PowerShell with breaking changes that are deemed necessary so that they can more accurately assess the impact of those breaking changes. For release versions of PowerShell, an experimental feature has one of three possible outcomes:
16
+
PowerShell has support for experimental features, which some may think covers this need; however, the intent of experimental features is to allow the community to try pre-release versions of PowerShell with breaking changes that are deemed necessary or new features that are not necessarily fully tested/polished so that they can more accurately assess the impact of those features. For release versions of PowerShell, an experimental feature has one of three possible outcomes:
17
17
18
-
1. The breaking change in the experimental feature is deemed necessary and accepted by the community as not harmful to adoption of new versions, in which case the experimental feature is no longer marked as experimental.
19
-
1. The breaking change in the experimental feature is deemed necessary, but considered harmful to adoption of new versions, in which case the experimental feature is changed to an optional feature.
20
-
1. The breaking change in the experimental feature is deemed not useful enough, in which case the experimental feature is deprecated.
18
+
1. The the experimental feature is deemed necessary, adequately tested/polished and accepted by the community as not harmful to adoption of new versions, in which case the experimental feature is no longer marked as experimental.
19
+
1. The experimental feature is deemed necessary, and adequately tested/polished, but considered harmful to adoption of new versions, in which case the experimental feature is changed to an optional feature.
20
+
1. The experimental feature is deemed not useful enough, in which case the experimental feature is deprecated.
21
21
22
-
In some cases a breaking change may be implemented immediately as an optional feature, when it is known up front that such a breaking change would be considered harmful to adoption of new versions of PowerShell.
22
+
In some cases a breaking change may be implemented immediately as an optional feature, when it is known up front that such a breaking change would be considered harmful to adoption of new versions of PowerShell if it was in place by default yet is still found important enough to implement as an optional feature.
23
23
24
24
Given all of that, we need to add support for optional features in PowerShell so that what is described above becomes a reality.
25
25
@@ -28,8 +28,8 @@ As an example of a feature that will be optional if implemented, see RFCNNNN-Pro
28
28
## Motivation
29
29
30
30
As a script, function, or module author,
31
-
I can enable optional features in my scripts or modules,
32
-
so that I can leverage new functionality that could break existing scripts.
31
+
I can enable optional features in specific scopes,
32
+
so that I can leverage new functionality that may break existing scripts without risk.
This parameter set would enable optional features in the current script file.
164
-
165
-
Entries in this collection would either be string (the name of the optional feature to enable) or a hashtable with two keys: `name` and `enabled`. The hashtable allows an optional feature to be specifically disabled instead of enabled within a script.
166
-
167
-
A terminating error is generated if the same optional feature name is used twice in the collection passed into the `-OptionalFeatures` parameter.
170
+
This parameter set would enable, or disable if `-Disabled` is used, optional features identified by `-Name` in the current script file.
168
171
169
172
### New command: Get-OptionalFeatureConfiguration
170
173
@@ -222,10 +225,10 @@ The `Disable-OptionalFeature` command will disable an optional feature in curren
This command would enable an optional feature for the duration of the `ScriptBlock` identified in the `-ScriptBlock` parameter, and return the feature to its previous state afterwards. This allows for easy use of an optional feature over a small section of code.
231
+
This command would enable or disable the optional features whose names are identified in the `-Enable` and `-Disable` parameters for the duration of the `ScriptBlock` identified in the `-ScriptBlock` parameter, and return the features to their previous state afterwards. This allows for easy use of optional features over a small section of code. If neither `-Enable` or `-Disable` are used, a terminating error is thrown.
229
232
230
233
### Checking optional feature states within the PowerShell runtime
0 commit comments