Feature #16037
Updated by sawa (Tsuyoshi Sawada) over 5 years ago
Pattern matching in `in` argument seems to prohibit multiple occurrences of single/double-splatted variables. ```ruby case ""; in *foo, Integer, bar; end # >> NoMatchingPatternError (Not SyntaxError) case ""; in *foo, Integer, *bar; end # >> SyntaxError: unexpected * ``` However, unlike conventional constant/variable assignment, it makes sense to have multiple occurrences of single/double-splatted variables in a single pattern matching provided that we have a definite rule regarding whether the splats are greedy or not. I propose the following. 1. Relax the syntax for pattern matching in `in` argument to allow multiple occurrences of single/double-splatted variables, and set up a rule regarding whether the splats are greedy or not; preferably greedy. 2. Further, introduce new syntax for non-greedy splats `*?foo`, `**?foo`. Currently, they are syntactically invalid, so I don't think they would conflict with existing code.