Project

General

Profile

Actions

Misc #20441

closed

Should passing keyword args to method_name(*) be an error?

Added by ozydingo (Andrew Schwartz) 7 months ago. Updated 7 months ago.

Status:
Closed
Assignee:
-
[ruby-core:117631]

Description

In the following method:

def foo(*)
  super
end

it is apparently the intended ruby 3 behavior to pass keyword args as a positional Hash to super. I believe this is confusing and can lead to hidden and hard-to-discover bugs (e.g. #20440). Since * is meant to only represent positional args, should it be an ArgumentError to pass keyword args at all to this method? Similar to how it is an error to pass positions args to bar(**).

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0