Issue #15799 has been updated by dgutov (Dmitry Gutov).


Matz:

Ruby being a "Lisp-2" means that the pipeline operator couldn't be implemented like a "normal" operator (all of them being translated to methods on Object or etc), but it could be implemented on the parser level, like almost all the other languages do which have it. Clojure implements it as a macro, but I don't think it's an option here. Sure, you could say that it would make it un-Ruby-like, and I might agree. However, *that* is the pipeline operator a significant number of Ruby programmers might be happy to have.

I don't think, however, that there is much value in adding a language feature that looks like it, but behaves differently. We already have method chaining in the language (it's the most common feature of modern OO languages), why add this?

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

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