From: ruby-core@... Date: 2018-09-19T01:59:24+00:00 Subject: [ruby-core:89076] [Ruby trunk Bug#15078] Hash splat of empty hash should not create a positional argument. Issue #15078 has been updated by marcandre (Marc-Andre Lafortune). akr (Akira Tanaka) wrote: > We can create `{}` with a special instance variable to distinguish them. I'm impressed by your creativity :-) So, would we have the following? ``` def foo(**opt) opt.instance_variable_get(:@no_keyword_arguments) end foo() # => true foo({}) # => true ? foo(**{}) # => false special = {}; special.instance_variable_set(:@no_keyword_arguments, true) foo(**special) # => true foo(special) # => true ``` So this would influence how if it gets converted to positional argument, right? ``` def bar(*args) args end bar(**{}) # => [{}] bar(**special) # => [] ``` ---------------------------------------- Bug #15078: Hash splat of empty hash should not create a positional argument. https://bugs.ruby-lang.org/issues/15078#change-74094 * Author: marcandre (Marc-Andre Lafortune) * Status: Open * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Target version: * ruby -v: ruby 2.6.0dev (2018-08-27 trunk 64545) [x86_64-darwin15] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- Looks like #10856 is not completely fixed, but I can't reopen it ``` def foo(*args); args; end foo(**{}) # => [] foo(**Hash.new) # => [{}], should be [] ``` -- https://bugs.ruby-lang.org/ Unsubscribe: