
Issue #20565 has been updated by zverok (Victor Shepelev).
I knew you can use keywords as names here but am not quite sure about this. Positional arguments (against my expectations from keyword arguments) don't allow any of these three versions. Should they also work?
The reason why keywords can be used in names is expressiveness on the caller site (not relevant to positional argument), like ```ruby validate :something, if: :something_else association :name, class: "Blah" ``` It is inconvenient to fetch such argument values, but it allows to create very expressive APIs. The alternative would be to have—sometimes discussed—“renaming” declarations in signatures, something like ```ruby def validate(name, condition if: nil) ``` With argument named `if:` by the caller, but available as a local variable `condition` in the method body. ---------------------------------------- Feature #20565: Relax formal argument at label https://bugs.ruby-lang.org/issues/20565#change-108753 * Author: nobu (Nobuyoshi Nakada) * Status: Open ---------------------------------------- Just a thought: if `def foo(if:)` is possible, shouldn't `def foo(C:)` and `def foo($g:)` also be possible...? -- https://bugs.ruby-lang.org/