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.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,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 512FD1F4BD for ; Wed, 2 Oct 2019 08:05:42 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 8944D120901; Wed, 2 Oct 2019 17:05:34 +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 74F34120A59 for ; Wed, 2 Oct 2019 17:05:30 +0900 (JST) Received: by filter0130p3las1.sendgrid.net with SMTP id filter0130p3las1-25136-5D945A4A-84 2019-10-02 08:05:30.918100104 +0000 UTC m=+47897.010981181 Received: from herokuapp.com (unknown [18.206.91.11]) by ismtpd0074p1mdw1.sendgrid.net (SG) with ESMTP id Zh8hjP7JSRyga-ElNdqCeg for ; Wed, 02 Oct 2019 08:05:30.765 +0000 (UTC) Date: Wed, 02 Oct 2019 08:05:30 +0000 (UTC) From: matz@ruby.or.jp Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70740 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16182 X-Redmine-Issue-Author: mame X-Redmine-Issue-Assignee: matz X-Redmine-Sender: matz 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?bXEIHGfdFwsIlBTndiToCp=2Fmc2rfxRD2sZAksRKJIHUjpZlykfThTqUdzg6gV+?= =?us-ascii?Q?zr1h5z1WjflqTzJQ0SHPKxuX7fWNsMpqyte4SAk?= =?us-ascii?Q?bZZco74YjY0heewpnU9+QfUF8QIpjqgMHiUnPJD?= =?us-ascii?Q?v33sBchr40TgBi5n5Da0=2FMes+ZzTaHxyDLAISxq?= =?us-ascii?Q?Vb62nfuov+4xp41kUJImFEa1skUHKrnLvQw=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95185 Subject: [ruby-core:95185] [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 updated by matz (Yukihiro Matsumoto). I vote for 3 in the OP. Matz. ---------------------------------------- Feature #16182: Should `expr in a, b, c` be allowed or not? https://bugs.ruby-lang.org/issues/16182#change-81817 * 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/