From: keystonelemur@... Date: 2019-06-14T08:28:00+00:00 Subject: [ruby-core:93134] [Ruby trunk Feature#15799] pipeline operator Issue #15799 has been updated by baweaver (Brandon Weaver). I wonder if it would be possible to get method objects somehow. `.:` was capable of doing this off of objects, but doing it in the main namespace is not easy. If pipeline operators in an Elixir style were considered, it may be able to aliased to `then` and be sugar for that. `&` could already be used for `Proc` type objects, could `.:` be a standalone prefix for local methods? ```ruby def double(n) n * 2 end increment = -> n { n + 1 } 5 |> &.:double # then / .: prefix |> &increment # then / to_proc |> to_s(2) # . method call |> reverse # . method call |> to_i # . method call ``` This may address some concerns, but I'm still not happy with my implementation here yet. I will think on this and consider some alternatives. I believe the crux here to be `method -> proc` coercion. If that can be done cleanly or inferred in a pipeline that would make it much easier. ---------------------------------------- Feature #15799: pipeline operator https://bugs.ruby-lang.org/issues/15799#change-78563 * 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: