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=-0.9 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=no 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 727F11F4B5 for ; Wed, 13 Nov 2019 15:32:03 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id ACFB3120B39; Thu, 14 Nov 2019 00:31:49 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 1FB1D120B30 for ; Thu, 14 Nov 2019 00:31:46 +0900 (JST) Received: by filter0183p3mdw1.sendgrid.net with SMTP id filter0183p3mdw1-716-5DCC21DE-D9 2019-11-13 15:31:42.957689404 +0000 UTC m=+159807.434428024 Received: from herokuapp.com (unknown [54.173.56.33]) by ismtpd0005p1iad1.sendgrid.net (SG) with ESMTP id 2fBLRXqmR-6ONYNxOE4abw for ; Wed, 13 Nov 2019 15:31:42.850 +0000 (UTC) Date: Wed, 13 Nov 2019 15:31:42 +0000 (UTC) From: manga.osyo@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 71473 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16340 X-Redmine-Issue-Author: osyo X-Redmine-Sender: osyo 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?EoIqruA4Er0CjiyK1+U6TJuuQMCAZ3OX2ybarlx6ke75G8YExqMdKQPOIHWt4j?= =?us-ascii?Q?PeB0le1U1C6WS=2FIwyOA8HKZJvLfRpKoKh3qDe5L?= =?us-ascii?Q?8YmdZAXBMjR5ak2snhI0K10Xp+syR5ggG3AVguI?= =?us-ascii?Q?tUtFG++btLNPoY2NVteNvxdNpcxmnQ2Bms3XCbZ?= =?us-ascii?Q?KEYDq67ig06eEhHL6hdZTnzxmtUXOaqcBFQ=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95844 Subject: [ruby-core:95844] [Ruby master Bug#16340] There are cases where `eval("_ 1")` does not refer to Numbered parameter 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 #16340 has been updated by osyo (manga osyo). @Eregon Thanks comment! > Do you have any realistic use case where you would want your expected behavior? No. However, I thought it was strange behavior and reported. I agree to reject. ---------------------------------------- Bug #16340: There are cases where `eval("_ 1")` does not refer to Numbered parameter https://bugs.ruby-lang.org/issues/16340#change-82677 * Author: osyo (manga osyo) * Status: Rejected * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.7.0dev (2019-11-11T10:03:43Z trunk 9d3213ac85) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- ## Steps to reproduce 1. Define local variable `_1` outside block 2. Call Numbered parameter in block 3. Call `eval("_1")` in same block ## Expected behavior ```ruby _1 = :local_variable proc { _1 # return Numbered parameter(_1) eval("_1") # => :argument }.call :argument ``` ## Actual behavior ```ruby _1 = :local_variable proc { _1 # return local variables outside block eval("_1") # => :local_variable }.call :argument ``` This is strange behavior because I want to expect to reference `_1` in block. ## Note * Return Numbered parameter if not define local variables outside block ```ruby # _1 = :local_variable proc { _1 # Actual behavior # return Numbered parameter eval("_1") # => :argument }.call :argument ``` -- https://bugs.ruby-lang.org/