[ruby-core:114453] [Ruby master Feature#14579] Hash value omission

Issue #14579 has been updated by olivierlacan (Olivier Lacan). Has it been considered to ever expand this feature to allow instance variables and global variables. Or was it strictly reserved for local variables intentionally, to avoid incompatible or dangerous behavior? Thanks for adding this regardless, it's a wonderful feature. ---------------------------------------- Feature #14579: Hash value omission https://bugs.ruby-lang.org/issues/14579#change-104215 * 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/
participants (1)
-
olivierlacan (Olivier Lacan)