From: josh.cheek@... Date: 2019-06-16T08:11:29+00:00 Subject: [ruby-core:93175] [Ruby trunk Feature#15799] pipeline operator Issue #15799 has been updated by josh.cheek (Josh Cheek). The operator doesn't bother me, though I can't think of any time I'd use it. Several suggested alternatives seem to want to leave the syntax ambiguous, leaving it unclear whether the piped thing is the receiver or the arg and its unclear where the method comes from. This means the syntax would remain ambiguous until execution time. You could potentially add a method in one location, which caused the syntax to change in another. I think Haskell's dollar sign would be more useful. It lowers precedence, which, would also allow dropping of parentheses. From @mame's blog, it sounds like that's the purpose of this operator. ```ruby x = 1.. $ .take 10 $ .map {|e| e*2} x # => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20 p 10.times.map $ do |i| 2*Math::PI*i/10 end # >> [0.0, 0.6283185307179586, 1.2566370614359172, 1.8849555921538759 1 + 2 $ * 3 # => 9 ``` The downside of using `$` is that it may conflict with the Perl style hooked variables. ---------------------------------------- Feature #15799: pipeline operator https://bugs.ruby-lang.org/issues/15799#change-78616 * 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: