From: merch-redmine@... Date: 2020-04-10T07:27:40+00:00 Subject: [ruby-core:97781] [Ruby master Feature#15921] R-assign (rightward-assignment) operator Issue #15921 has been updated by jeremyevans0 (Jeremy Evans). Cases where `=>` is used outside hashes, arrays, and method call arguments currently are syntax errors. This changes things so that they are not syntax errors, but mean something quite different. I foresee this as a source of future bugs and confusion, especially to new Ruby programmers. Here are some other examples that look similar but act very different: * `a=>b` vs `[a=>b]` * `{(a => b) => c}` vs `{p(a => b) => c}` * `->{a=>b}.call` vs `{a=>b}`. Are we going to mark this as experimental (similar to the pipeline operator was when it was introduced last year), or are we sure this syntax will be supported in Ruby 3? ---------------------------------------- Feature #15921: R-assign (rightward-assignment) operator https://bugs.ruby-lang.org/issues/15921#change-84997 * Author: nobu (Nobuyoshi Nakada) * Status: Closed * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- From https://bugs.ruby-lang.org/issues/15799#change-78465, proposal of the rightward-assignment operator by `=>`. ``` $ ./ruby -v -e '(1..).lazy.map {|x| x*2} => x' -e 'p x.first(10)' ruby 2.7.0dev (2019-06-12T06:32:32Z feature/rassgn-assoc c928f06b79) [x86_64-darwin18] last_commit=Rightward-assign by ASSOC [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] ``` https://github.com/nobu/ruby/tree/feature/rassgn-assoc -- https://bugs.ruby-lang.org/ Unsubscribe: