From: "knu (Akinori MUSHA)" Date: 2021-09-16T09:22:46+00:00 Subject: [ruby-core:105293] [Ruby master Feature#14579] Hash value omission Issue #14579 has been updated by knu (Akinori MUSHA). ...Which is that `{ symbol: }` verbosely means `{ symbol: binding.local_variable_defined?(:symbol) ? binding.local_variable_get(:symbol) : __send__(:symbol) }` with no exception, no matter if the symbol is `if`, `self`, `fork` or `return` or whatever. ---------------------------------------- Feature #14579: Hash value omission https://bugs.ruby-lang.org/issues/14579#change-93702 * Author: shugo (Shugo Maeda) * Status: Closed * 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: