Issue #16496 has been updated by mame (Yusuke Endoh).

Status changed from Open to Rejected

`_1 *1` is parsed as `_1(*1)`, a call to a method `_1` with a variable-length argument with `1`.  It is the same as `p * ary` and `p *ary`.  You can see a warning under verbose mode:

```
$ ruby -w -e '-> { _1 *1 }.call'
-e:1: warning: `*' interpreted as argument prefix
...
```

It is difficult to change until a method name `_1` is valid.

----------------------------------------
Bug #16496: Numbered Parameter not parsed properly in lambda
https://bugs.ruby-lang.org/issues/16496#change-83742

* Author: JustinFeng (Justin Feng)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin18]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
The space between `*` and `1` changes the lambda behaviour, looks like numbered parameter `_1` is not parsed properly

```
2.7.0 :001 > l = -> { _1 * 1 }
2.7.0 :002 > l[2]
 => 2
2.7.0 :003 > l2 = -> { _1 *1 }
2.7.0 :004 > l2[2]
Traceback (most recent call last):
        5: from /Users/justin.feng/.rvm/rubies/ruby-2.7.0/bin/irb:23:in `<main>'
        4: from /Users/justin.feng/.rvm/rubies/ruby-2.7.0/bin/irb:23:in `load'
        3: from /Users/justin.feng/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/irb-1.2.1/exe/irb:11:in `<top (required)>'
        2: from (irb):4
        1: from (irb):3:in `block in irb_binding'
ArgumentError (wrong number of arguments (given 1, expected 0))
2.7.0 :005 >
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>