From: realfengjia@foxmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:96750] [Ruby master Bug#16496] Numbered Parameter not parsed properly in lambda
Date: Fri, 10 Jan 2020 02:21:06 +0000 (UTC) [thread overview]
Message-ID: <redmine.issue-16496.20200110022105.44f2828ee6a46f7b@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-16496.20200110022105@ruby-lang.org
Issue #16496 has been reported by JustinFeng (Justin Feng).
----------------------------------------
Bug #16496: Numbered Parameter not parsed properly in lambda
https://bugs.ruby-lang.org/issues/16496
* Author: JustinFeng (Justin Feng)
* Status: Open
* 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/
next parent reply other threads:[~2020-01-10 2:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-16496.20200110022105@ruby-lang.org>
2020-01-10 2:21 ` realfengjia [this message]
2020-01-10 2:49 ` [ruby-core:96752] [Ruby master Bug#16496] Numbered Parameter not parsed properly in lambda mame
2020-01-11 11:49 ` [ruby-core:96786] " realfengjia
2020-01-11 12:34 ` [ruby-core:96787] " mame
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.issue-16496.20200110022105.44f2828ee6a46f7b@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).