Skip to content

Deferred input pipelines #15206

@iRon7

Description

@iRon7

Aside from the requests for a $PSIndex, index-variable in foreach pairing:

It would also be nice if we could have parallel input streams

This:

$Count = (1..3 |)

Causes currently an error:

An empty pipe element is not allowed.

Instead it could possibly create a kind of a "deferred pipeline object" and each time the object is used/invoked it processes and returns the next item in the deferred pipeline (until it is empty where it returns an AutomationNull)

Wishful thinking:

$Count = (1..3 |) # Initialize the deferred pipeline object
$Count
1
$Count
2
$Count
3
$Count # Nothing (`AutomationNull`) returns

More specific:

$a = (Get-Connect .\MyHughFile.txt |) # or any other long stream
$b = (1..1e9 |) # In the idea, the range shouldn't affect the memory used for $b 
$c = (Import-Csv .\Large.csv |)
$a | ForEach-Object {
    Write-Host '$a item:' $_ 
    Write-Host '$b item:' $b # Every time the $b is used, it processes the next item in the deferred $b pipeline
    Write-Host '$c item:' $c # Ditto for $c
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-DeclinedThe proposed feature is declined.WG-Languageparser, language semantics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions