Issue #21875 has been updated by Eregon (Benoit Daloze). nobu (Nobuyoshi Nakada) wrote in #note-4:
Rather I think it should be allowed even after optional/rest/keyword/keyword-rest arguments in block parameters too.
Wouldn't that be **very** confusing then because `proc { |a,| a }.call([1,2]) => 1` splats but `proc { |a, kw: 1,| a }.call([1,2]) => [1, 2]` wouldn't splat? That is the comma would have very different meaning based on its position. It seems far safer to keep things as-is, rather than introduce semantic ambiguity without even a use case for this change (multiline lambda/block parameters are very rare). How about closing this for now (keep things as-is) since there is no use case and there are clear disadvantages/problems? ---------------------------------------- Feature #21875: Handling of trailing commas in lambda parameters https://bugs.ruby-lang.org/issues/21875#change-116604 * Author: Earlopain (Earlopain _) * Status: Open ---------------------------------------- https://bugs.ruby-lang.org/issues/19107 was accepted, which is about trailing commands in method definitions. lambdas were not explicitly mentioned but I wanted to confirm how they should behave with a trailing comma. Or if a trailing comma should even be accepted for them. It's not clear to me since lambdas sometimes behave like blocks and sometimes more like methods. `->(...) {}` for example is syntax invalid (same as in blocks) but they do check their arity with blocks don't do. If a trailing comma is accepted it can either * be implicit splat like in `foo do |bar,|; end` or `foo do |bar|; end`. It would also mean that the trailing comma is only allowed after a positional argument. * Just be ignored and be accepted in most places like for method definitions. The first option would be rather useless in regards to https://bugs.ruby-lang.org/issues/19107 when you just want to add the comma for cleaner diffs. But I guess for lambdas this happens very rarely anyways. -- https://bugs.ruby-lang.org/