From: "shugo (Shugo Maeda)" Date: 2021-09-15T06:13:53+00:00 Subject: [ruby-core:105258] [Ruby master Feature#14579] Hash value omission Issue #14579 has been updated by shugo (Shugo Maeda). Status changed from Closed to Assigned matz (Yukihiro Matsumoto) wrote in #note-16: > I assumed the value should be a local variable. The merged patch calls the method when the local variable is not defined. > I doubt this is sufficient behavior. Any opinion? I believe a method should be called when a local variable is not defined. Because it's convenient as knu stated, and because `{x:}` is a syntax sugar of `{x: x}` except that keywords are allowed. ---------------------------------------- Feature #14579: Hash value omission https://bugs.ruby-lang.org/issues/14579#change-93668 * Author: shugo (Shugo Maeda) * Status: Assigned * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- 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: