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=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham 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) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 639891F4CC for ; Mon, 9 Dec 2024 03:21:17 +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=PkyO4A7n; 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=D+IBFHU1; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1733714444; bh=zAbDVWcIf3vDLw6lyHTtSE5WY6qxXSH3ir7mICn0wW8=; 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=PkyO4A7n6xsDtVDUxG+L7BbBiGAsWaF9x7rlSXiIC7XtN8iw2tS6OXHhY5SsGPzcp x7wlFIqLTpQztxa1ZiqQHs7vlBYcN6R2Rn8gbkh1K5TPjvGDa7dQioz9fVV6dOo4tX bLoaLJ9qedKdDwOgEP3YqPoFdUg2ewltFa0aVY9s= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id C63C144D48 for ; Mon, 9 Dec 2024 03:20: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=D+IBFHU1; 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 3CCB944BAD for ; Mon, 9 Dec 2024 03:20:34 +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=jwWbUxW2II6H2IpYu49kOBrjQ1vgfUBbI/MOVBg5LnM=; b=D+IBFHU1Zr3IcvfRMgih0Z9ado/E3kKO6wJdjbSZUJNFJ6v/42abnAdQWC+c2hBDzZ+M MxFSHo49KuTAHXaaJC0lH0HHu/uKFjuL4BQ6hgCMqY6K+aIm/5yWI6PaF6Zq+8lf5sPtwq MYjEneGtKYJYfBGY0oNEvVF/aZ5adMLu1UxN9p3nrem3NNde/PjwV167ivZKR6KduU2PPr 0V1L6dx38SWGbLt3MO9gSzSvgqinuaJ3cif+GqJlin91Jv3mjP49jgMHpomAVw8sC7oz59 tyYTTfiIVSmujQDtNkAix4xPTbYVDc7B1fwBwy0viujSno+JnsZ4CyfJkYPww3lw== Received: by recvd-5f54b5d587-zdng7 with SMTP id recvd-5f54b5d587-zdng7-1-67566200-1 2024-12-09 03:20:32.671322708 +0000 UTC m=+2094986.973230199 Received: from herokuapp.com (unknown) by geopod-ismtpd-24 (SG) with ESMTP id -bEnSnJZTQi51BmjhjV87w for ; Mon, 09 Dec 2024 03:20:32.588 +0000 (UTC) Date: Mon, 09 Dec 2024 03:20:32 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 20925 X-Redmine-Issue-Author: Dan0042 X-Redmine-Issue-Priority: Normal X-Redmine-Sender: martinemde 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: 96812 X-SG-EID: =?us-ascii?Q?u001=2Eopza1WMDlu8e6eeEdYakaGZO4qQWXtKpv0RZheTwgt02Ca28xB4tEMOQ2?= =?us-ascii?Q?d+Cp7hM9FvbrelQMmJJdWbowxoO9aqZiVtt52hc?= =?us-ascii?Q?ksYG32YzsW+bJU78NZ4WyVZ49iSCdvwpGC6IuSm?= =?us-ascii?Q?GtMxdrjJWGdB=2FS5VuUbsDMlGpivzhSZ+sqCDUGU?= =?us-ascii?Q?214k0kaKFKyst8BF4Hr7b81q93LwVi5qEoNVMH1?= =?us-ascii?Q?l1=2FXaANzVKY=2Fm3K4QGiGRcStPvaCI5I=2FawFNLE3?= =?us-ascii?Q?jvx75TzjrivJJfs28yJBVoAnQw=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: 4Q4Q2KTJGZW64QCIVXE5IIQ4KFYNRJDY X-Message-ID-Hash: 4Q4Q2KTJGZW64QCIVXE5IIQ4KFYNRJDY 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:120135] [Ruby master Feature#20925] Allow boolean operators at beginning of line to continue previous line List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "martinemde (Martin Emde) via ruby-core" Cc: "martinemde (Martin Emde)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20925 has been updated by martinemde (Martin Emde). The difference seems nice when you consider code like: ``` if request.secret_key_base.present? && request.encrypted_signed_cookie_salt.present? && request.encrypted_cookie_salt.present? request.encrypted_cookie end ``` which is much easier to read than ``` if request.secret_key_base.present? && request.encrypted_signed_cookie_salt.present? && request.encrypted_cookie_salt.present? request.encrypted_cookie end ``` ---------------------------------------- Feature #20925: Allow boolean operators at beginning of line to continue previous line https://bugs.ruby-lang.org/issues/20925#change-110884 * Author: Dan0042 (Daniel DeLorme) * Status: Open ---------------------------------------- I would like for this to become accepted syntax: condition1 || condition2 condition1 && condition2 condition1 or condition2 condition1 and condition2 This is similar to how method chaining on the second line was added in Ruby 1.9 expr .method And it has the same advantage: when you have a multi-line expression, instead of hunting for the dot or boolean operator at the end of line1, it's right there at the beginning of line2, making the structure very obvious and readable. Please contrast: request.secret_key_base.present? && request.encrypted_signed_cookie_salt.present? && request.encrypted_cookie_salt.present? && request.use_authenticated_cookie_encryption request.secret_key_base.present? && request.encrypted_signed_cookie_salt.present? && request.encrypted_cookie_salt.present? && request.use_authenticated_cookie_encryption The first expression must rely on indentation to communicate the multi-line nature of the condition, and even then it's not as immediately obvious as the second expression, where we can see easily and immediately that this is a multi-line `&&` condition. This syntax is also similar to how a trailing comma is allowed in arrays and hashes (and method calls since Ruby 1.9), with the same advantage. It makes for a cleaner diff when you add an element to the array/hash/conditional. Taking the previous example, imagine we are adding the condition `&& request.use_authenticated_cookie_encryption`. Now contrast the diff between the two styles: request.secret_key_base.present? && request.encrypted_signed_cookie_salt.present? && - request.encrypted_cookie_salt.present? + request.encrypted_cookie_salt.present? && + request.use_authenticated_cookie_encryption request.secret_key_base.present? && request.encrypted_signed_cookie_salt.present? && request.encrypted_cookie_salt.present? + && request.use_authenticated_cookie_encryption Based on the above I would say this syntax is natural and consistent with existing Ruby syntactical elements, and would greatly improve code readability. -- 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/