Issue #15799 has been updated by shioyama (Chris Salzberg).


Responses to this change:

- Twitter: https://twitter.com/a_matsuda/status/1139110957450375168
- Reddit: https://www.reddit.com/r/ruby/comments/c059d2/pipeline_operator_in_ruby/
- Github (mentioned above): https://github.com/ruby/ruby/commit/f169043d#commitcomment-33926163

I watched [the video](https://www.youtube.com/watch?v=5eAXAUTtNYU) in Japanese, and here's my rough summary.

The operator has lower precedence than `.`, so you can do this:

```ruby
a .. b |> each do
end
```

With `.`, because of its higher precedence, you'd have to do use braces:

```ruby
(a..b).each do
end
```

That's actually the main reason this change was proposed and accepted (AFAICT). No other substantial arguments are given. A few people mention they really want the right direction (`<|` I guess) more than the proposed left direction (`|>`).

Matz does very briefly address what most people have said they dislike about this feature, by saying that actually, Elixir's pipeline is not a "real" pipeline either. I'm not really sure what that means by that, but Elixir's pipeline operator is one of the most attractive features of the language, so if you're going to borrow the syntax, you'd better follow the meaning. And this doesn't.

Beyond that, there's a bunch of unicode jokes about arrows and pointing hands, etc., but no real debate or discussion. Interestingly, Matz actually mentions that he doesn't think this feature should be released in 2.7 (but now it seems like it will).

What's funny though is that in the video, this example is given as Elixir usage:

```elixir
x |> func1 |> func2
func2(func1(x))
```

Then this corresponding example is given in Ruby with methods:


```ruby
x |> method1(1) |> method2(2)
```

but when they start translating that to what it should mean in live code, it starts coming out as:

```ruby
method()...
```

then Matz says "Naranai naranai, chigau gengo ni natteiru" ("no no, that's a different language") and it's "fixed" to:

```ruby
x.method1(1).method2(2)
```

So obviously, this is something that is going to trip up almost everyone, including Ruby committers!

The bigger point IMHO though is that major controversial decisions are made based on this kind of very brief, mostly closed discussion. [I don't think that's a good thing for our community](https://twitter.com/shioyama/status/1139168800794791936).

----------------------------------------
Feature #15799: pipeline operator
https://bugs.ruby-lang.org/issues/15799#change-78547

* 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>