From: daniel@...42.com Date: 2020-04-16T13:59:58+00:00 Subject: [ruby-core:97921] [Ruby master Feature#15921] R-assign (rightward-assignment) operator Issue #15921 has been updated by Dan0042 (Daniel DeLorme). Until now I thought `=>` made perfect sense, given that it's already used in `rescue`, but Jeremy's counterpoint examples are very convincing. There's a high potential for confusion and bugs. Even matz says confusing cases should be warned. I think `=>` feels natural only because it's preceded by the `rescue` keyword. That makes it easy to tell apart from other `=>` syntax. This is similar to how pattern matching has syntax very similar to hash literals but you can tell them apart because the pattern is preceded by the `in` keyword. So I'd like to propose `=|>` for rightward assignment. Full proposal at #16794 ---------------------------------------- Feature #15921: R-assign (rightward-assignment) operator https://bugs.ruby-lang.org/issues/15921#change-85144 * 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: