Actions
Feature #21875
openHandling of trailing commas in lambda parameters
Feature #21875:
Handling of trailing commas in lambda parameters
Status:
Open
Assignee:
-
Target version:
-
Description
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,|; endorfoo 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.
Actions