Actions
Bug #13717
closedCalling lambda with keyword arguments inconsistent behavior
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-darwin16]
Description
Context: I am running a callback hook that can have multiple arguments (or none) and multiple keywords (or none).
The idea is to run this and just pass on the params:
hook.call(*args, **kw_args)
But I've encountered an issue which is an inconsistency at the same time:
hook = lambda { |a|
}
hook.call(:a, **{}) # works
kws = {};
hook.call(:a, **kws) # wrong number of arguments (2 for 1)
I would expect the params to just be passed if there are any, or none passed at all, if the object supplied is empty.
Updated by nobu (Nobuyoshi Nakada) over 7 years ago
- Is duplicate of Bug #10856: Splat with empty keyword args gives unexpected results added
Updated by nobu (Nobuyoshi Nakada) over 7 years ago
- Status changed from Open to Closed
Applied in changeset trunk|r59519.
splat keyword hash
-
compile.c (compile_array_keyword_arg): set keyword splat flag if
explicitly splatted. [ruby-core:68124] [Bug #10856] -
vm_args.c (setup_parameters_complex): try keyword hash splat if
given.
Actions
Like0
Like0Like0