From: matz@... Date: 2017-02-22T05:49:02+00:00 Subject: [ruby-core:79654] [Ruby trunk Feature#12995][Rejected] Conditional expression taking a receiver outside the condition Issue #12995 has been updated by Yukihiro Matsumoto. Status changed from Open to Rejected Interesting proposal but this changes the meaning of `if` and `case` too much. Matz. ---------------------------------------- Feature #12995: Conditional expression taking a receiver outside the condition https://bugs.ruby-lang.org/issues/12995#change-63071 * Author: Tsuyoshi Sawada * Status: Rejected * Priority: Normal * Assignee: * Target version: ---------------------------------------- Since a conditional expression has a return value, we can continue a method chain after a conditional expression like this: ```ruby if hoge foo1.foo2.foo3 else bar1.bar2 end .baz1.baz2.baz3.baz4 ``` ```ruby case hoge when hoge1 foo1.foo2.foo3 when hoge2 bar1.bar2 end .baz1.baz2.baz3.baz4 ``` It is convenient if we can have a condition after or in the middle of a chain. I would like to do this: ```ruby baz1.baz2.baz3.baz4. if hoge foo1.foo2.foo3 else bar1.bar2 end ``` ```ruby baz1.baz2.baz3.baz4 if hoge .foo1.foo2.foo3 else .bar1.bar2 end ``` ```ruby baz1.baz2.baz3.baz4. case hoge when hoge1 foo1.foo2.foo3 when hoge2 bar1.bar2 end ``` ```ruby baz1.baz2.baz3.baz4 case hoge when hoge1 .foo1.foo2.foo3 when hoge2 .bar1.bar2 end ``` -- https://bugs.ruby-lang.org/ Unsubscribe: