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=-2.8 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 61A631F4BD for ; Tue, 1 Oct 2019 13:37:07 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 0BA721208A8; Tue, 1 Oct 2019 22:36:59 +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 B10C5120A2D for ; Tue, 1 Oct 2019 22:36:55 +0900 (JST) Received: by filter0137p3mdw1.sendgrid.net with SMTP id filter0137p3mdw1-11358-5D935677-EC 2019-10-01 13:36:55.68450567 +0000 UTC m=+666501.945919013 Received: from herokuapp.com (unknown [54.173.8.255]) by ismtpd0004p1iad2.sendgrid.net (SG) with ESMTP id zC50GmtNQaupxg-g4Kudhw for ; Tue, 01 Oct 2019 13:36:55.589 +0000 (UTC) Date: Tue, 01 Oct 2019 13:36:55 +0000 (UTC) From: shevegen@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70726 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16182 X-Redmine-Issue-Author: mame X-Redmine-Issue-Assignee: matz X-Redmine-Sender: shevegen 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?6lbdtOg4RDRLuxD00eQtQKgoNAsge5d4xND7cbMQd0wDC65SpvTTl5Wmpdt5Du?= =?us-ascii?Q?yRbfxjAdcTUsW7sgpFGwtNdukC0pNnpOgycJEFV?= =?us-ascii?Q?YWyEKFBHvdnd3EjfE1jMWhyxmriEi2NIZpEjskm?= =?us-ascii?Q?0KThZVcd2NondzcMfXKfANqavVrMLayMAdvZ48n?= =?us-ascii?Q?twAwHxyDUQbObD=2FiKEoPdf4YfiMbLbjIoWA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95171 Subject: [ruby-core:95171] [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 shevegen (Robert A. Heiler). I can not comment/answer on the issue and questions; I think this is for matz and the core team to decide either way, whatever the way. I did, however had, want to add that: json in {a:, b:, c:} is quite difficult to read (for me). So even if this may not be an ideal explanation, but ... I would not be at all opposed to disallowing that, merely syntax-wise alone. ;-) (I do not really have a big opinion on the functionality in general but ideally my personal taste is to prefer simpler syntax, whenever that is possible. We have in general quite some suggestions that combine a lot of complex syntax together, which I think is not ideal, in general; also in other proposals.) ---------------------------------------- Feature #16182: Should `expr in a, b, c` be allowed or not? https://bugs.ruby-lang.org/issues/16182#change-81807 * 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/