Project

General

Profile

Actions

Feature #14579

closed

Hash value omission

Added by shugo (Shugo Maeda) over 3 years ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:85950]

Description

How about to allow value omission in Hash literals:

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

And in keyword arguments:

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

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

Files

hash_value_omission.diff (619 Bytes) hash_value_omission.diff shugo (Shugo Maeda), 03/06/2018 01:51 PM

Related issues

Related to Ruby master - Feature #11105: ES6-like hash literalsRejectedActions
Related to Ruby master - Feature #18124: Hash shorthands (matching constructors functionality in JS)ClosedActions
Has duplicate Ruby master - Feature #17292: Hash Shorthand / PunningClosedActions
Actions

Also available in: Atom PDF