[ruby-core:76175] [Ruby trunk Feature#12519][Rejected] Expansion of modifier_if and modifier_unless

From: matz@...
Date: 2016-06-28 13:03:10 UTC
List: ruby-core #76175
Issue #12519 has been updated by Yukihiro Matsumoto.

Status changed from Open to Rejected

Agreed to Marcus.

Matz.


----------------------------------------
Feature #12519: Expansion of modifier_if and modifier_unless
https://bugs.ruby-lang.org/issues/12519#change-59382

* Author: Blaise Koch
* Status: Rejected
* Priority: Normal
* Assignee: 
----------------------------------------
Hi all.

I propose a syntax change to allow the below to be valid ruby.

```ruby
variable = 1 if false else 2
```

This is an extension of the current `modifier_if` below which accomplishes the same result.

```ruby
variable = 1 if false
variable = 2 if !false
```

keeping up with the other condition-statement keyword the below should be valid as well.

```ruby
variable = 1 unless true else 2
```

And is an extension of 

```ruby
variable = 1 unless true
variable = 2 unless !true
```

While it's true that ternary syntax accomplishes the same task, I feel that the proposed changes are both more readable and a more natural extension of the language.



-- 
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>

In This Thread

Prev Next