Skip to content

Proposal for inline splatting #25029

Closed as duplicate
Closed as duplicate

Description

Summary of the new feature / enhancement

Sometimes I just declare a temp variable used for nothing else other than for splatting a function call:

$p = @{a=1;b=2;c=3}
Some-Func -AdditionalParam 4 @p -AnotherParam 5

However, I do this as a means of dealing with the fact that PowerShell does not have a way to do inline splatting.

I propose the following syntax:

Some-Func @:@{a=2;b=2;c=3}                             # Functions
& "somescript.ps1" @:@{d=4;e=5;f=6}                    # Script files
& $someScriptBlock @:@{g=7;h=8;i=9}                    # Script blocks
& $somePSObject.SomeScriptMethod.Script @:@(1,2,3,4,5) # Script methods

Proposed technical implementation details (optional)

No response

Activity

  1. anonhostpi commented on Feb 15, 2025

    @anonhostpi
    Author

    Another consideration for those who prefer array splatting:

    & $someScriptBlock @:@( 1,2,3 )
    
    Some-Func @:(&{
        $externalValue1
        Generate-MeSomeValues
        @( 1,2,3 )
    })
  2. mklement0 commented on Feb 15, 2025

    @mklement0
    Contributor

    Indeed, inline splatting would be nice.

    This was first proposed a long time ago:

    GitHub
    RFC (Request for Comments) documents for community feedback on design changes and improvements to PowerShell ecosystem - PowerShell/PowerShell-RFC
  3. mklement0 commented on Feb 16, 2025

    @mklement0
  4. anonhostpi commented on Feb 20, 2025

    @anonhostpi
    Author

    Is there a process to request that a RFC be revisited or re-opened?

    I understand that there was conflict with which method should be used, but honestly, I'd just be happy with any method over no method at all

  5. mklement0 commented on Feb 20, 2025

    @mklement0
    Contributor

    Speaking in no official capacity whatsoever:

    My personal sense is that the RFC process is all but dead (as of this writing, there are no drafts except an accepted one that submitted in 2022 and has not been implemented since).

    I suspect that in practice feature requests have taken their place, if they get tagged for review by the relevant WG (working group).

    I've lost track of the original discussion and why the proposal was rejected.
    If you feel inspired, you could try to summarize the old debate here and make a case for your proposal in relation to it.

  6. jborean93 commented on May 27, 2025

    @jborean93
    Collaborator

    I'm attempting to take another stab at splatting enhancements in PowerShell and have opened a summary of the various options proposed over the years and am hoping to get feedback from anyone interested. If you are interested in having a look and/or wanting to comment on some of the options I would love any feedback at jborean93/PowerShell-RFC#1.

    The aim is to get more community consensus around the various options before settling on a real RFC based on the feedback and going from there.

  7. SeeminglyScience commented on Jul 2, 2025

    @SeeminglyScience
    Contributor

    Centralizing all of the issues about inline splatting in #25721

  8. microsoft-github-policy-service commented on Jul 2, 2025

    @microsoft-github-policy-service
    Contributor

    📣 Hey @Blue Falcon (@anonhostpi), how did we do? We would love to hear your feedback with the link below! 🗣️

    🔗 https://aka.ms/PSRepoFeedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions