Skip to content

Common -Splat parameter #25574

@iRon7

Description

@iRon7

Summary of the new feature / enhancement

The proposal for inline splatting has been rejected some time ago.

See: #25029:

This was first proposed a long time ago:

Rejected RFC: https://github.com/PowerShell/PowerShell-RFC/blob/master/Archive/Draft/RFC0002-Generalized-Splatting.md

Related discussion: PowerShell/PowerShell-RFC#6
A related PR that was therefore ultimately not accepted: #10073

As far I understand the issue behind the rejection: the discussion was meanly focused on an operator that could pass an unnamed argument which would require a semantic sugar in the engine that might conflict with other syntaxes or initiate a break change.
If the splatting could be done by means of a common named parameter (e.g. -Splat [Object[]]), the impact on the enige would be less and I guess easier to implement, while this would be more PowerShell compliant and support inline usage:

Wishful thinking:

New-AzVm -Splat @{
    Name = $Name
    Location = "West US"
    ResourceGroupName = "myResourceGroup"
    VirtualNetworkName = "myVnet"
    SubnetName = "mySubnet"
    SecurityGroupName = "myNetworkSecurityGroup"
    PublicIpAddressName = "myPublicIpAddress"
}

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