News for hackers. Stuff that matters.
Re:Rails is not written in Ruby by omoikane on Friday February 04, 2022 @06:03PM (#30214724)
Re:Rails is not written in Ruby by leifg on Friday February 04, 2022 @06:41PM (#30215135)
If I understand the Ruby pipeline operator it's essentially an alias of the dot. The example in the feature tracker is:

``` 1.. |> take 10 |> map {|e| e2} |> (x) ```

which is equivalent to

``` (1...).take(10).map{|e| e2} ```

So in order to use it you still need extensions on every single object. The only reason that looks nice is because in this example you continuously call methods on lists that return a list. You can't add `my_custom_list_operation(list_input)` in between.

Re:Rails is not written in Ruby by WallowingInShit on Saturday February 05, 2022 @10:31AM (#30222028)
Same thing, but for JavaScript: https://github.com/tc39/proposal-pipeline-operator

Going forward, the pipe operator is going to be showing up in many new languages. I've used elixir a lot, and the pipe operator is a genius piece of syntactic sugar.

Re:Rails is not written in Ruby by dragonwriter on Friday February 04, 2022 @07:10PM (#30215414)
It's worth noting that that version of pipeline operator was abandoned, while there are still (some newer) open feature requests for a more traditional functional-style pipeline operator.
Re:Rails is not written in Ruby by tylerscott on Friday February 04, 2022 @09:38PM (#30216519)
yield_self is an less elegant way to achieve basically the same thing as |>.