[ruby-core:93426] [Ruby trunk Feature#15799] pipeline operator
From:
eregontp@...
Date:
2019-06-30 10:38:10 UTC
List:
ruby-core #93426
Issue #15799 has been updated by Eregon (Benoit Daloze).
I remembered an old blog post from over 10 years ago by Dave Thomas, and finally found it:
https://pragdave.me/blog/2007/12/30/pipelines-using-fibers-in-ruby-19.html
Interestingly the syntax is a bit similar to functional languages:
```ruby
pipeline = evens | multiples_of_three | multiples_of_seven
```
My interpretation of this is many Rubyists want a functional/Elixir-like pipe operator.
There is even still an open issue about that: #14392, and probably more issues and definitely more blog posts wanting that.
And yet the operator we introduced doesn't address that, is redundant with `.` and doesn't work for normal assignment.
----------------------------------------
Feature #15799: pipeline operator
https://bugs.ruby-lang.org/issues/15799#change-78970
* Author: nobu (Nobuyoshi Nakada)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
Implemented the pipeline operator `|>`, a topic of "ruby committers vs the world" in RubyKaigi 2019.
Also a casual idea of rightward assignment.
```ruby
1.. |> take 10 |> map {|e| e*2} |> (x)
p x #=> [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
```
https://github.com/nobu/ruby/tree/feature/pipeline
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>