Add enhanced splatting RFC draft #1
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a draft RFC of an enhanced splatting proposal. While I have my own recommendations there is no final choice as of yet to open with the real RFC.
This RFC aims to enhance the existing splatting mechanism in PowerShell to support
It is not aiming to:
PSCustomObject
,string
splatting, etcSo far my gut choice would be Option 4 - the
-@
parameter with support for using multiple instances of-@
to splat with.This option offers the most flexibility around its use, consistency with all the splatting scenarios, and only a small risk of being a breaking change but I can agree that people may not expect this syntax. Happy to be convinced otherwise!
Using Option 1
Test-Function @@{...}
is a strong contender and most likely what people's gut reaction will be. My thoughts are that it doesn't have a consistent syntax and made even more problematic when attempting to support expressions. For example inline literals need another@
and an expression is even more complicated if you are trying to avoid breaking changes:Any suggestions around formatting or edits to this to make it concise or alternatives formats are more than welcome. Would love to see people's thoughts around what is shown here before moving onto the next step.
If you wish to convey your desired option please react with 1 of these 5 reactions
@@<expr>
..<expr>
@[<expr>]
-@
param-splat
operator