From: eregontp@...
Date: 2019-04-27T13:23:05+00:00
Subject: [ruby-core:92436] [Ruby trunk Feature#15799] pipeline operator

Issue #15799 has been updated by Eregon (Benoit Daloze).


My early thinking about this syntax is it's a very narrow use-case.
Is it anything more than `.` and no need for parentheses in some rare cases?
There is also the RHS assignment which feels very unnatural to me.

I think there is nothing wrong with having parentheses for Range, I think they actually help readability.
Martin's desugared version which works today is actually shorter and I believe most would agree it's also clearer.

To be fair, I don't particularly like Haskell code and find it very cryptic, which this is getting closer to.

Also, if we actually introduce a pipeline operator, I think it's much more useful to have Elixir semantics of passing the result as the first argument of the RHS, than just a different syntax for `.`.

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

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* 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 {|x| x*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>