From: shevegen@... Date: 2018-03-09T02:55:30+00:00 Subject: [ruby-core:86063] [Ruby trunk Feature#14579] Hash value omission Issue #14579 has been updated by shevegen (Robert A. Heiler). I agree with Matthew. I understand the suggestion trying to make the syntax even more succinct but I think it's one step too much. Ruby already has a quite condensed syntax. I think this syntax here: h = { "x" => , "y" => } Has a slight "visual" problem, at the least to me. I would expect => to "point" to something on the right hand side, which the normal syntax in hashes, in ruby, requires (unless you use the foo: :bar syntax notation). ---------------------------------------- Feature #14579: Hash value omission https://bugs.ruby-lang.org/issues/14579#change-70928 * Author: shugo (Shugo Maeda) * Status: Open * 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: