Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse pipeline? #40

Closed
laggingreflex opened this issue Jun 27, 2016 · 3 comments
Closed

Reverse pipeline? #40

laggingreflex opened this issue Jun 27, 2016 · 3 comments
Labels
duplicate Duplicate of another bug outdated

Comments

@laggingreflex
Copy link

laggingreflex commented Jun 27, 2016

This is regular:

"hello" |> doubleSay |> capitalize |> exclaim

How about reverse pipeline with a new operator: <|

exclaim <| capitalize <| doubleSay <| "hello"

There were previous talks about Elixir-like syntax

// Elixir style
run("hello") |> withThis(10) |> andThis(20)
// is equivalent to
andThis( withThis( run("hello"), 10 ), 20 )

👎 Gives a new semantic meaning to what looks like a normal function call. For example, withThis(10) is no longer just calling that function with one argument
👎 Putting the left-hand side as the first argument to the right-hand side is pretty arbitrary.

With reverse pipline (and additional feature of applying arguments from the right) it could be written as

run("hello") |> withThis <| 10 |> andThis <| 20

When both operators are used in an expression like this, the resverse pipe accepting arguments from the right would apply them _after_ the arguments coming from the regular pipeline from the left.

Regular pipeline takes higher precedence than reverse pipeline.

run("hello") |> withThis <| 10 |> andThis <| 20
____________    ______________
______________________________    _____________

Thoughts?

@Mouvedia
Copy link

dupe of #3

@TehShrike TehShrike added the duplicate Duplicate of another bug label Sep 22, 2016
@TehShrike
Copy link
Collaborator

Closing in favor of #3

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate Duplicate of another bug outdated
Projects
None yet
Development

No branches or pull requests

3 participants