From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [94.130.110.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id C952B1F4C1 for ; Wed, 13 Nov 2024 13:40:16 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=BQ4ams29; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=aPaDEv8+; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1731505184; bh=5+mCcTzxTJdc/y9Bk4Srzd6jdyRRu3kWyqA59HXrBYM=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=BQ4ams29GUsAmaV6q95Xd25bUVRdUVuYoOTDnVw3REx63zcXwsCXNEDjsORArmlUu YDkJaTawTWbWbult5YdvZWtba34UOOLSfmpAkQDk8PaAJxpIwg7zxHwk1nXxAluMDV i7cHUiN9zUDalALsc0dgZ7OQZOKQkzlFXRfdY8UA= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 843D744BC6 for ; Wed, 13 Nov 2024 13:39:44 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=aPaDEv8+; dkim-atps=neutral Received: from s.wrqvtzvf.outbound-mail.sendgrid.net (s.wrqvtzvf.outbound-mail.sendgrid.net [149.72.126.143]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 28F4C44B56 for ; Wed, 13 Nov 2024 13:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=Ettz09VB3EEmV97m3ZxOLNv+mfqPGrYdLwTY1fT8oes=; b=aPaDEv8+oBBxENbHgpit20p8r6qCY/Xs02wFSSvM6j7UtIsCE4OQloVwn/Nv6EztzMja Z7QOrsErOVD/bvn7pDlOJUXfCdirsVrStYlWWMlDcoRqVrVBcK1slnW8IDA+wmEc8OleU+ s/8LZpiSHFWURb1s3KC8YGhzb4bFwifbkc+V+I6qKf0otHYklsWTr/I4b5R9eZRAPQEfja zpsxdHyNNa53viTrZMsY/Rk6jMLqX14B4Rf0hRW6h5FxymYMhKRQiT1vSX7yQXyRrM13ND 3Jppuzsrj0G6zAhOtsO63TKK8JRjptw2HiNcmC4FHiCIuFFy7xzvhBYYwhq6KeYg== Received: by recvd-7cc7f7d978-rxvm4 with SMTP id recvd-7cc7f7d978-rxvm4-1-6734AC13-5 2024-11-13 13:39:31.12895564 +0000 UTC m=+5341418.619550606 Received: from herokuapp.com (unknown) by geopod-ismtpd-16 (SG) with ESMTP id O-7eUgEqS_GAQyToT_YZ6w for ; Wed, 13 Nov 2024 13:39:31.021 +0000 (UTC) Date: Wed, 13 Nov 2024 13:39:31 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 20785 X-Redmine-Issue-Author: tompng X-Redmine-Issue-Assignee: matz X-Redmine-Issue-Priority: Normal X-Redmine-Sender: Eregon 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: 96587 X-SG-EID: =?us-ascii?Q?u001=2EByjZWvxTCjdoV8K03xEuhE7KqN4thWULFLM7+oH78KY30oYB3qFthsDpL?= =?us-ascii?Q?4w4cbYa3ttBh8bAHPOnE=2FkzPba67JNu7Lnrked2?= =?us-ascii?Q?O7K9VQ=2FJax1qGhqC5alZIi0DUOrVNVmoIaGN2Mu?= =?us-ascii?Q?gbvcgecXM9=2Fc2j96C2PmUKRzPXcRVropnAPq0WS?= =?us-ascii?Q?LeaaO0z1cPxfDutdxADdCEVP1nQfKnOUBFD=2FqyV?= =?us-ascii?Q?IoKLIRQpTVyeWR3d1ijFFZB8bXJC6aal7DDTjrM?= =?us-ascii?Q?0WP20kznT8V6kjvpZiuDobRcyg=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: 4C5QYQXVHCMCNBXOF2N22B5COGZP6ISG X-Message-ID-Hash: 4C5QYQXVHCMCNBXOF2N22B5COGZP6ISG X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:119916] [Ruby master Bug#20785] Should `a in b, and c` `a in b, or c` `a in b, rescue c` be syntax ok? List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "Eregon (Benoit Daloze) via ruby-core" Cc: "Eregon (Benoit Daloze)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20785 has been updated by Eregon (Benoit Daloze). I think @Dan0042 has a point. For instance if I'm using some longer variables names and the array/tuple has many elements it would be natural to wrap it into two lines, but IIUC this change would break it: ```ruby if tuple in element_type, element_size, dimensions, pointer, offset, buffer_length, stride ... end # might be wrapped as: if tuple in element_type, element_size, dimensions, pointer, offset, buffer_length, stride ... end ``` In the OP description, I think all cases can be very easily made clear and unambiguous by appending `*`. For example: ```ruby tap do a in b, * and c a in b, * or c a in b, * rescue c end tap do a in b, * end tap do a in b, * rescue end ``` >>From that I *think* considering trailing comma for `in` pattern matching as SyntaxError is good, as it encourages clarity and removes syntactical ambiguity (at least from a human perception). ---------------------------------------- Bug #20785: Should `a in b, and c` `a in b, or c` `a in b, rescue c` be syntax ok? https://bugs.ruby-lang.org/issues/20785#change-110637 * Author: tompng (tomoya ishida) * Status: Assigned * Assignee: matz (Yukihiro Matsumoto) * ruby -v: ruby 3.4.0dev (2024-10-04T03:22:53Z master 939ec9f080) +YJIT +MN +PRISM [arm64-darwin22] * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- This code is accepted in parse.y but rejected in prism ~~~ruby tap do a in b, and c a in b, or c a in b, rescue c end # parsed as tap do (a in b,;) and c (a in b,;) or c a in b,; rescue c end ~~~ I think these should be rejected like prism (parse.y accepts) ~~~ruby a in b, and c a in b, and c tap do a in b, rescue c end ~~~ I think these should be accepted like parse.y (prism rejects) ~~~ruby tap do a in b, end tap do a in b, rescue end ~~~ -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/