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.1 required=3.0 tests=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 C6DFF1F463 for ; Thu, 26 Sep 2019 08:04:13 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 154CD120B36; Thu, 26 Sep 2019 17:04:03 +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 A7562120936 for ; Thu, 26 Sep 2019 17:04:00 +0900 (JST) Received: by filter0187p3mdw1.sendgrid.net with SMTP id filter0187p3mdw1-23175-5D8C70F2-6F 2019-09-26 08:04:02.52930359 +0000 UTC m=+213617.161415871 Received: from herokuapp.com (unknown [34.207.207.12]) by ismtpd0042p1mdw1.sendgrid.net (SG) with ESMTP id oFFC_ZDgRvyYoTGgrGZ5YQ for ; Thu, 26 Sep 2019 08:04:02.444 +0000 (UTC) Date: Thu, 26 Sep 2019 08:04:02 +0000 (UTC) From: mame@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70653 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16182 X-Redmine-Issue-Author: mame X-Redmine-Issue-Assignee: matz 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=2FinyA1V0bXouTB4FkWnzNiKb48LbRe7LyRGPlq3CG8zcb?= =?us-ascii?Q?jsDZRn318QD3jfasc5HFnEu3+MmhwATHGbNUD4f?= =?us-ascii?Q?v0xi5WROXS7V5U2nPJLAv=2Fc6opAE2DvZRkR8EcD?= =?us-ascii?Q?S+UB7QhTP1Kkbu+0d8v8+WCFV+pSD8W79k4IUPs?= =?us-ascii?Q?9nL0HzTZXXeCl7jK8ak9jrorjLmkOBSdyDQ=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95098 Subject: [ruby-core:95098] [Ruby master Feature#16182] Should `expr in a, b, c` be allowed or not? 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 #16182 has been reported by mame (Yusuke Endoh). ---------------------------------------- Feature #16182: Should `expr in a, b, c` be allowed or not? https://bugs.ruby-lang.org/issues/16182 * Author: mame (Yusuke Endoh) * Status: Open * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Target version: ---------------------------------------- In #15865, a new syntax ` in ` was introduced. By using this, we can write: ``` json = { foo: 1, bar: 2} if json in { foo:, bar: } p [foo, bar] #=> [1, 2] end ``` However, we cannot write: ``` p(json in { foo:, bar: }) #=> expected: true, actual: syntax error ``` This is because ` in ` is an expression but not an argument. For example, `foo(json in a, b, c)` is ambiguous: it is considered `foo((json in a), b, c)` and `foo((json in a, b, c))`. What should we do? 1. Do nothing; we admit that it is a spec 2. Revert the feature 3. Disallow a pattern like `a, b, c` or `a:, b:, c:` in this one-line pattern matching syntax; we ask a user to write `json in [a, b, c]` or `json in {a:, b:, c:}` -- https://bugs.ruby-lang.org/