From: keystonelemur@... Date: 2019-06-14T02:51:09+00:00 Subject: [ruby-core:93122] [Ruby trunk Feature#15799] pipeline operator Issue #15799 has been updated by baweaver (Brandon Weaver). I have written on my opinions here: https://dev.to/baweaver/ruby-2-7-the-pipeline-operator-1b2d But in summary, I believe this feature could be substantially more expressive and powerful if it adjusted its lookup chain from directly calling on an object to searching the local scope for procs and methods. Please consider: ```ruby def double(n) n * 2 end increment = -> n { n + 1 } 5 |> double # Method |> increment # Proc |> to_s(2) # self.to_s ``` This would find the `double` method locally and use it, passing the value as an argument in a way that is expected in other pipeline implementations. It would then pass to a local proc (without `&` prefix) and also give its argument to it. Lastly, `to_s` would not be found so it would resolve to the Object itself and follow the regular call-chain through. I believe strongly that this would be a huge win for expressive power in the Ruby language if such a feature were fully implemented, but as it is now it is only an alias for what already exists. ---------------------------------------- Feature #15799: pipeline operator https://bugs.ruby-lang.org/issues/15799#change-78551 * 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: