From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 1C39A1F885 for ; Sat, 11 Jan 2020 12:35:05 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id E3CBC1209F6; Sat, 11 Jan 2020 21:34:45 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 66B7C120992 for ; Sat, 11 Jan 2020 21:34:43 +0900 (JST) Received: by filterdrecv-p3iad2-57f487d66-r5wpm with SMTP id filterdrecv-p3iad2-57f487d66-r5wpm-20-5E19C0E2-19 2020-01-11 12:34:42.245296973 +0000 UTC m=+2202483.561287500 Received: from herokuapp.com (unknown [54.224.129.129]) by ismtpd0020p1iad2.sendgrid.net (SG) with ESMTP id ir-u3_3_Sym33oIXGvcWeQ for ; Sat, 11 Jan 2020 12:34:42.098 +0000 (UTC) Date: Sat, 11 Jan 2020 12:34:42 +0000 (UTC) From: mame@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 72450 X-Redmine-Project: ruby-master X-Redmine-Issue-Id: 16496 X-Redmine-Issue-Author: JustinFeng X-Redmine-Sender: mame X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?EJh2gqwnyqXtd++xo=2FinyA1V0bXouTB4FkWnzNiKb49ybVNkQxS7a45Ju7R=2Fci?= =?us-ascii?Q?6+uCGfoIZGKUJycuivGkmsiCL+UG66hZbxC1Ke7?= =?us-ascii?Q?1h2XWoDUCUVLjj=2FHjPAwZFLbOAbXntSbujaMwgM?= =?us-ascii?Q?BTDDCKp7SVJ9Qgmtyei9EROyBqadEadMAMlX34Q?= =?us-ascii?Q?8aHOSZ5GPzJZ3q1T2=2F7cvgdCyXpmXxhkqfNr2g2?= =?us-ascii?Q?QEB7z+OgWMv7Qzsgo=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 96787 Subject: [ruby-core:96787] [Ruby master Bug#16496] Numbered Parameter not parsed properly in lambda X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #16496 has been updated by mame (Yusuke Endoh). We are now migrating. If we change it immediately, a program that uses `_1` as a method name will break. So it is now warned: ``` warning: `_1' is reserved for numbered parameter; consider another name ``` After enough time, we will be able to prohibit `_1` as a method name, and `_1` can be always used as a numbered parameter. So please wait for a few years. ---------------------------------------- Bug #16496: Numbered Parameter not parsed properly in lambda https://bugs.ruby-lang.org/issues/16496#change-83782 * Author: JustinFeng (Justin Feng) * Status: Feedback * 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 `
' 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 `' 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/