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) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 00CDD1F4CC for ; Thu, 9 Jan 2025 06:48:52 +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=xvedRM1J; 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=GQy635Um; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1736405330; bh=cUiIND4U61AND/HZ005+75PeJyj6prx0u6e9nySP6eE=; 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=xvedRM1JCeiVUBL1COpyg5ViR0QZ+vwcE35i92N1z1B9m3KSQB/AGT/rPeyjmwtYr bTqxPMU7hZ5wNOVCnbUhxcGyXYVgKnsZphuMk2xSfj03XHExKELLmGq2D6oO2wbDBr HZLtVneLlKpaMhJUuiPPbIXm0pH9b8/5NvKFjJdc= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 58DBE467CB for ; Thu, 9 Jan 2025 06:48:50 +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=GQy635Um; dkim-atps=neutral Received: from s.wrqvtbkv.outbound-mail.sendgrid.net (s.wrqvtbkv.outbound-mail.sendgrid.net [149.72.123.24]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 0A88A4679A for ; Thu, 9 Jan 2025 06:48:44 +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=DSbcgqsk7TRIfo8nb1AmOYPPjP3k7Y4G6YYzjRTNfss=; b=GQy635UmAFbDzwjqlwftw5Q6p52qCgmm1bZP8pm865WpelTs06H0v2Kwrg61ZCjSk+4c 7G+xpKLwnSosaMR3cAcd3Uu80cP6Xr/119ebf3+NKr1mezZHX0L6dLxAZ2yHNpPgfcTloJ fH2AYNbNwxjKlP8f/IF5ccyxKcbi/ED3q/xj0+X86eJnUWe8/09ydz9VOcDCBp8ToT2pmA vxYXhFuGxncncsyjvGBX+8c4X81dl4hCrYzSFSYWiN1c4reXEZVQl7mF6b8LJ/9T+jUS9N pWuLCaPhHdMaGR0+7KxvHofNGFpPqr4rquj/BEPkT7Zwkpd0iaUV8/eBikLtVihA== Received: by recvd-84b546689d-d2nml with SMTP id recvd-84b546689d-d2nml-1-677F714B-17 2025-01-09 06:48:43.388777619 +0000 UTC m=+4786010.646381595 Received: from herokuapp.com (unknown) by geopod-ismtpd-5 (SG) with ESMTP id af75WlpcTwuhu5uoX_m-tA for ; Thu, 09 Jan 2025 06:48:43.314 +0000 (UTC) Date: Thu, 09 Jan 2025 06:48:43 +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: nobu 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: 97247 X-SG-EID: =?us-ascii?Q?u001=2E5PtzXJ23KrYzgM1nrOIr+EQ222PyrDaWSg0Er8CZ8tP86xyXmBM81zBKD?= =?us-ascii?Q?HreavdFYMbHjxXOR6UPMkt=2Fu9CyBIp6y52n8D2y?= =?us-ascii?Q?qA9zqurrgUck9C56VfDDfqS2GqZ1YySrkrCNXnC?= =?us-ascii?Q?zb5tjEQpG=2Ffto0mW8DUBXueuspi=2Fl1JvAVspM7p?= =?us-ascii?Q?VkUaXahNZaauJ5XBKRRChJE+H4mGdI8CkWF5Kwl?= =?us-ascii?Q?vFHnsPEzPQSH17tnGqUYCdRazI3hf4fUUe+shtr?= =?us-ascii?Q?ZxWPI2fX3tjWX70KMcErDrj1HA=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: CCUCTOFN7SZRZJNRH43FQNRJPEH7OJLH X-Message-ID-Hash: CCUCTOFN7SZRZJNRH43FQNRJPEH7OJLH 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:120563] [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: "nobu (Nobuyoshi Nakada) via ruby-core" Cc: "nobu (Nobuyoshi Nakada)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20925 has been updated by nobu (Nobuyoshi Nakada). Dan0042 (Daniel DeLorme) wrote in #note-8: > a = b > && c > should be parsed as > > a = (b > && c) > correct? That would not change the RHS of assignment. Currently the first line in the former is complete code. I mean that the second line will change the RHS to `b && c`. ---------------------------------------- Feature #20925: Allow boolean operators at beginning of line to continue previous line https://bugs.ruby-lang.org/issues/20925#change-111384 * 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/