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=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY 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 E8F021F5AE for ; Sun, 16 May 2021 08:13:16 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A9BEA120F7C; Sun, 16 May 2021 17:12:04 +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 DF7D3120F7C for ; Sun, 16 May 2021 17:12:01 +0900 (JST) Received: by filterdrecv-6b4886b6-tmtq7 with SMTP id filterdrecv-6b4886b6-tmtq7-1-60A0D40E-1B 2021-05-16 08:13:02.430873373 +0000 UTC m=+826956.057023774 Received: from herokuapp.com (unknown) by geopod-ismtpd-canary-0 (SG) with ESMTP id -3X_psQOTpevm2hoYVVVzg for ; Sun, 16 May 2021 08:13:02.412 +0000 (UTC) Date: Sun, 16 May 2021 08:13:02 +0000 (UTC) From: kazuki@callcc.net Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 17724 X-Redmine-Issue-Author: jnchito X-Redmine-Issue-Assignee: ktsj X-Redmine-Sender: ktsj 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-Redmine-MailingListIntegration-Message-Ids: 79907 X-SG-EID: =?us-ascii?Q?3wX5hDsNIpPDewbs9kQAKZeAyQUx87HvQIsV33WX5Rd9455bQozy7MhOgHAVPN?= =?us-ascii?Q?LHhydrsDj0OmlLYAoJuwBFBu=2FHaCjWfy7b2L3Sy?= =?us-ascii?Q?DHe=2F175kVifUa5bJiPnxhZMy+9EJqfcyMvm0ItV?= =?us-ascii?Q?MwGnK6stWwo4TOV8l6AAntEBSfjrfQq+cVNctMU?= =?us-ascii?Q?GygeMrbSeKCPsHVPrpieKcIZ1Ss9ZkOtZAQ=3D=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 103860 Subject: [ruby-core:103860] [Ruby master Feature#17724] Make the pin operator support instance/class/global variables 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 #17724 has been updated by ktsj (Kazuki Tsujimoto). Backport deleted (2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN) ruby -v deleted (ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]) Subject changed from Pattern matching error message is confusing to Make the pin operator support instance/class/global variables Tracker changed from Bug to Feature > I think it makes sense to also support instance/class/global variables directly. I agree. What do you think, @matz? ---------------------------------------- Feature #17724: Make the pin operator support instance/class/global variables https://bugs.ruby-lang.org/issues/17724#change-91984 * Author: jnchito (Junichi Ito) * Status: Assigned * Priority: Normal * Assignee: ktsj (Kazuki Tsujimoto) ---------------------------------------- When I use pattern match with instance variables, I get an error message like "expecting local variable or method" ``` ruby @n = 1 case 1 in ^@n # ... end #=> syntax error, unexpected instance variable, expecting local variable or method (SyntaxError) # in ^@n # ^~ ``` However using method is not allowed, either. ``` ruby def n = 1 case 1 in ^n # ... end #=> n: no such local variable (SyntaxError) ``` I think the message "expecting local variable or method" is confusing and should be fixed like "expecting local variable." -- https://bugs.ruby-lang.org/