[ruby-core:86131] [Ruby trunk Feature#14579][Rejected] Hash value omission

From: shugo@...
Date: 2018-03-15 07:49:23 UTC
List: ruby-core #86131
Issue #14579 has been updated by shugo (Shugo Maeda).

Status changed from Open to Rejected

matz (Yukihiro Matsumoto) wrote:
> I prefer this syntax to #11105, but this introduces a Ruby-specific syntax different from ES6 syntax.
> Besides that, I don't like both anyway because they are not intuitive (for me).

So I withdraw this proposal.


----------------------------------------
Feature #14579: Hash value omission
https://bugs.ruby-lang.org/issues/14579#change-71007

* Author: shugo (Shugo Maeda)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
How about to allow value omission in Hash literals:

```ruby
x = 1
y = 2
h = {x:, y:}
p h #=> {:x=>1, :y=>2}
```

And in keyword arguments:

```ruby
def login(username: ENV["USER"], password:)
  p(username:, password:)
end

login(password: "xxx") #=> {:username=>"shugo", :password=>"xxx"}
```


---Files--------------------------------
hash_value_omission.diff (619 Bytes)


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