[#92891] Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1? — Al Snow <jasnow@...>
Tried the new 2.7.0-preview1 upgrade to Ruby and see that bundler is also upgraded (to 2.1.0.pre.1).
5 messages
2019/05/30
[#92892] Re: Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1?
— SHIBATA Hiroshi <hsbt@...>
2019/05/30
Bundler 2.1.0.pree.1 is the expected version.
[ruby-core:92725] [Ruby trunk Feature#15799] pipeline operator
From:
jonathan@...
Date:
2019-05-19 22:05:06 UTC
List:
ruby-core #92725
Issue #15799 has been updated by jonathanhefner (Jonathan Hefner).
Eregon (Benoit Daloze) wrote:
> 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 `.`.
I agree that the pipeline operator should introduce new semantics, instead of being an alias of `.`.
While Elixir uses `|>` to insert a first argument to the RHS, F# and Elm use `|>` to append a last argument to the RHS (due to different conventions regarding function parameter order).
One use-case for such "last argument" behavior in Ruby is file IO:
```ruby
File.read("file.txt").gsub(/foo/, "bar") |> File.write "file.txt"
```
Of course it gets tricky when option arguments are involved. But perhaps kwargs could be handled specially, such that the LHS of `|>` is inserted before them. For example, the following would both work as expected:
```ruby
File.read("other.txt") |> File.write "file.txt", mode: "a"
```
```ruby
File.read("other.txt") |> File.write "file.txt", **options
```
----------------------------------------
Feature #15799: pipeline operator
https://bugs.ruby-lang.org/issues/15799#change-78084
* 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>