Skip to content

Proposal for inline splatting #25029

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

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