
Issue #20675 has been updated by jeremyevans0 (Jeremy Evans). The reason for this inconsistency is backwards compatibility, so as not to break existing code when omitted hash value support was added in Ruby 3.1. There is historical precedence for breaking backwards compatibility for a very similar case. In this example: ```ruby def foo arg: 123 arg end foo # Ruby < 2.0: SyntaxError # Ruby 2.0: 123 # Ruby >= 2.1: ArgumentError, missing keyword: arg ``` There was no deprecation warning for the change in 2.1. I think if we want to change behavior for `foo arg:<newline>value` from `foo(arg: value)` to `foo(arg:); value`, we should add a deprecation warning in 3.4, and then change the behavior in 3.5. ---------------------------------------- Bug #20675: Parse error with required kwargs and omitted parens https://bugs.ruby-lang.org/issues/20675#change-109432 * Author: matz (Yukihiro Matsumoto) * Status: Open * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- As pointed out in https://github.com/mruby/mruby/issues/6268, keyword arguments without surrounding parens are a bit confusing, e.g. ```ruby def foo arg: 123 end ``` is parsed as ```ruby def foo(arg:) 123 end ``` where ```ruby k=25 f k: 10 ``` is parserd as ```ruby k=25 f(k: 10) ``` In summary, should we ignore newlines after keyword labels? Should we make them behave consistent? Matz. -- https://bugs.ruby-lang.org/